[hidden] { display: none !important; }

/* ---------- Thèmes de couleur selon la race du personnage ----------
   --t-fond : fond de page ; --t-panneau : en-tête et fiche ; --t-bloc : encarts ; --t-champ : listes et bulles
   du joueur ; --t-bord / --t-bloc-bord : bordures ; --t-doux / --t-pale : textes secondaires ;
   --t-accent : boutons ; --t-bouton2 : bouton secondaire. Par défaut (et pour le Nain) : le brun d'origine. */
:root, body[data-race="nain"], .carte-perso[data-race="nain"], body[data-race="demi-elfe-nain"], .carte-perso[data-race="demi-elfe-nain"], body[data-race="nain-mafia"], .carte-perso[data-race="nain-mafia"] {
  --t-fond: #1f1a16; --t-panneau: #2b221b; --t-bloc: #332820; --t-bloc-bord: #3f3228; --t-champ: #3a2f26;
  --t-bord: #6b5a48; --t-doux: #c9b79c; --t-pale: #8f826f; --t-accent: #9c4a1a; --t-bouton2: #5a4a3c;
}
/* Humain : beige, sable et pierre */
body[data-race="humain"], .carte-perso[data-race="humain"] {
  --t-fond: #24211b; --t-panneau: #36312a; --t-bloc: #403a31; --t-bloc-bord: #4f483d; --t-champ: #4a4338;
  --t-bord: #7d7362; --t-doux: #e0d3b8; --t-pale: #a39782; --t-accent: #9a7b4a; --t-bouton2: #625848;
}
/* Barbare : rouge sang et fourrure */
body[data-race="barbare"], .carte-perso[data-race="barbare"], body[data-race="amazone"], .carte-perso[data-race="amazone"] {
  --t-fond: #1e1413; --t-panneau: #2e1c1a; --t-bloc: #3a2320; --t-bloc-bord: #4a2c28; --t-champ: #432824;
  --t-bord: #7a4a42; --t-doux: #e0b8a8; --t-pale: #a07e72; --t-accent: #a3301f; --t-bouton2: #5e3a33;
}
/* Haut Elfe : bleu roi et argent */
body[data-race="haut-elfe"], .carte-perso[data-race="haut-elfe"], body[data-race="demi-haut-elfe"], .carte-perso[data-race="demi-haut-elfe"] {
  --t-fond: #10162a; --t-panneau: #18213f; --t-bloc: #1f2a4f; --t-bloc-bord: #2b3866; --t-champ: #26325c;
  --t-bord: #4c5e9c; --t-doux: #c9d4f0; --t-pale: #8794bd; --t-accent: #2f4fb8; --t-bouton2: #3a4878;
}
/* Demi-Elfe : sarcelle, entre forêt et ville */
body[data-race="demi-elfe"], .carte-perso[data-race="demi-elfe"] {
  --t-fond: #111d1e; --t-panneau: #19292b; --t-bloc: #1f3335; --t-bloc-bord: #2a4144; --t-champ: #263b3d;
  --t-bord: #4b6e70; --t-doux: #bfdad6; --t-pale: #82a19e; --t-accent: #2f7b78; --t-bouton2: #3a5a5b;
}
/* Elfe Sylvain : vert forêt */
body[data-race="elfe-sylvain"], .carte-perso[data-race="elfe-sylvain"], body[data-race="demi-sylvain"], .carte-perso[data-race="demi-sylvain"] {
  --t-fond: #121b13; --t-panneau: #1a2a1c; --t-bloc: #213423; --t-bloc-bord: #2c442e; --t-champ: #283d2a;
  --t-bord: #4f7350; --t-doux: #cfe3c4; --t-pale: #8fa886; --t-accent: #3f7d2f; --t-bouton2: #3f5a3e;
}
/* Elfe Noir : violet très sombre */
body[data-race="elfe-noir"], .carte-perso[data-race="elfe-noir"], body[data-race="demi-elfe-noir"], .carte-perso[data-race="demi-elfe-noir"] {
  --t-fond: #0d0a12; --t-panneau: #16111e; --t-bloc: #1d1627; --t-bloc-bord: #2a2038; --t-champ: #241b31;
  --t-bord: #4c3d63; --t-doux: #c8bcdc; --t-pale: #8a7ea0; --t-accent: #6a2d8c; --t-bouton2: #3d3050;
}
/* Orque : kaki et cuir sale */
body[data-race="orque"], .carte-perso[data-race="orque"] {
  --t-fond: #171912; --t-panneau: #23261a; --t-bloc: #2b2f20; --t-bloc-bord: #383d29; --t-champ: #333826;
  --t-bord: #606844; --t-doux: #d0d4b0; --t-pale: #959a76; --t-accent: #6b6a1f; --t-bouton2: #4a4f33;
}
/* Demi-Orque : ardoise et vert-de-gris */
body[data-race="demi-orque"], .carte-perso[data-race="demi-orque"], body[data-race="homme-bete"], .carte-perso[data-race="homme-bete"] {
  --t-fond: #15191a; --t-panneau: #202628; --t-bloc: #283032; --t-bloc-bord: #343e40; --t-champ: #2e383a;
  --t-bord: #57666a; --t-doux: #c8d4d2; --t-pale: #8d9a98; --t-accent: #4d6b5e; --t-bouton2: #435052;
}
/* Gobelin : vert acide et moutarde */
body[data-race="gobelin"], .carte-perso[data-race="gobelin"], body[data-race="demi-gobelin"], .carte-perso[data-race="demi-gobelin"] {
  --t-fond: #15180d; --t-panneau: #212612; --t-bloc: #2a3017; --t-bloc-bord: #363e1e; --t-champ: #313a1b;
  --t-bord: #66762f; --t-doux: #dfe8a8; --t-pale: #a1ab6c; --t-accent: #7c8f12; --t-bouton2: #4d5726;
}
/* Ogre : roche et terre */
body[data-race="ogre"], .carte-perso[data-race="ogre"], body[data-race="demi-ogre-elfique"], .carte-perso[data-race="demi-ogre-elfique"] {
  --t-fond: #1a1816; --t-panneau: #282522; --t-bloc: #312d29; --t-bloc-bord: #3e3934; --t-champ: #38332e;
  --t-bord: #6a625a; --t-doux: #d6cdc2; --t-pale: #9b9287; --t-accent: #7a5c3e; --t-bouton2: #524b44;
}
/* Semi-Homme : prairie et pain d'épice */
body[data-race="semi-homme"], .carte-perso[data-race="semi-homme"], body[data-race="semi-elfe"], .carte-perso[data-race="semi-elfe"] {
  --t-fond: #1b1a10; --t-panneau: #2a2817; --t-bloc: #34311c; --t-bloc-bord: #423e24; --t-champ: #3b3820;
  --t-bord: #73703f; --t-doux: #e6e0b4; --t-pale: #a8a27a; --t-accent: #8a6a24; --t-bouton2: #57532f;
}
/* Gnôme des forêts du Nord : mousse et amanite */
body[data-race="gnome-forets-nord"], .carte-perso[data-race="gnome-forets-nord"] {
  --t-fond: #13181a; --t-panneau: #1c2528; --t-bloc: #222e31; --t-bloc-bord: #2d3c40; --t-champ: #29373a;
  --t-bord: #4f6a6c; --t-doux: #cfe0d8; --t-pale: #8ea39c; --t-accent: #a8432c; --t-bouton2: #3d5052;
}
body { transition: background-color 0.4s; }
:root {
  --fond: #1f1a16;
  --parchemin: #f3eadb;
  --encre: #2b2118;
  --encre-douce: #7a6a58;
  --accent: var(--t-accent);
  --bord: #d9c9ae;
  --erreur: #a3271f;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  background: var(--t-fond); color: var(--encre);
  font-family: Georgia, "Times New Roman", serif;
}
header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: var(--t-panneau); color: var(--parchemin);
}
h1 { margin: 0; font-size: 26px; letter-spacing: 2px; display: inline; }
.sous-titre { margin-left: 10px; color: var(--t-doux); font-size: 14px; }
.reglages { display: flex; align-items: center; gap: 10px; font-family: system-ui, sans-serif; font-size: 14px; }
select, button, textarea { font: inherit; }
select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--t-bord); background: var(--t-champ); color: var(--parchemin); }
#depenses { color: var(--t-doux); }
button {
  padding: 8px 14px; border: none; border-radius: 6px; cursor: pointer;
  background: var(--t-accent); color: #fff; font-family: system-ui, sans-serif;
}
button:disabled { opacity: 0.5; cursor: wait; }
header button { white-space: nowrap; }
.creation .fiche h3 { font-family: system-ui, sans-serif; }
#nouvelle { background: var(--t-bouton2); }
#corps { flex: 1; display: flex; min-height: 0; }
main { flex: 1; overflow-y: auto; padding: 20px; }
#fil { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.aide { color: var(--t-doux); font-style: italic; text-align: center; }
.message { padding: 14px 18px; border-radius: 10px; line-height: 1.55; white-space: pre-wrap; }
.message.mj { background: var(--parchemin); border: 1px solid var(--bord); }
.message.joueur { background: var(--t-champ); color: var(--parchemin); align-self: flex-end; max-width: 80%; font-style: italic; }
.message.attente { background: var(--parchemin); color: var(--encre-douce); font-style: italic; }
.meta { margin-top: 8px; font-family: system-ui, sans-serif; font-size: 12px; color: var(--encre-douce); }
.alerte {
  max-width: 820px; margin: 0 auto 14px; padding: 10px 14px; border-radius: 8px;
  background: #f6dcd8; color: var(--erreur); font-family: system-ui, sans-serif; font-size: 14px;
}
form {
  display: flex; gap: 10px; padding: 12px 20px; background: var(--t-panneau);
  max-width: 100%;
}
textarea {
  flex: 1; resize: vertical; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--t-bord);
  background: var(--parchemin); color: var(--encre);
}
button.discret { background: transparent; border: 1px solid var(--t-bord); color: var(--t-doux); }
.compte { color: var(--parchemin); font-weight: 600; }
input {
  font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--t-bord);
  background: var(--parchemin); color: var(--encre);
}
.page-connexion { align-items: center; justify-content: center; }
.carte-connexion {
  display: flex; flex-direction: column; gap: 8px; width: min(360px, 90vw);
  padding: 28px; border-radius: 12px; background: var(--t-panneau); color: var(--parchemin);
  font-family: system-ui, sans-serif;
}
.carte-connexion h1 { font-family: Georgia, serif; text-align: center; }
.carte-connexion .sous-titre { margin: 0 0 12px; text-align: center; }
.carte-connexion button { margin-top: 12px; }
.carte-connexion .alerte { margin: 4px 0 0; }

/* ---- Fiche de personnage ---- */
#fiche { width: 290px; flex-shrink: 0; overflow-y: auto; padding: 16px; background: var(--t-panneau); color: var(--parchemin); font-family: system-ui, sans-serif; font-size: 14px; }
.fiche h2 { margin: 0; font-family: Georgia, serif; font-size: 22px; }
.fiche h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--t-doux); }
.fiche-sous-titre { margin: 2px 0; color: var(--t-doux); }
.fiche-ligne { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid var(--t-champ); }
.fiche-liste { margin: 0; padding-left: 18px; }
.creation .fiche { background: var(--t-panneau); color: var(--parchemin); border-radius: 10px; padding: 16px; }

/* ---- Création de personnage ---- */
.creation { max-width: 900px; margin: 0 auto; background: var(--parchemin); border-radius: 12px; padding: 20px 24px; font-family: system-ui, sans-serif; }
.creation h2, .creation h3 { font-family: Georgia, serif; margin: 0 0 8px; }
.creation-entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.creation .boutons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.creation button.discret { border-color: var(--bord); color: var(--encre); }
.creation button.principal { font-size: 16px; padding: 10px 18px; }
.etapes { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 12px 0; font-size: 12px; }
.etapes li { padding: 3px 8px; border-radius: 10px; background: #e6dcc9; color: var(--encre-douce); }
.etapes li.faite { background: #d9c9ae; color: var(--encre); }
.etapes li.active { background: var(--t-accent); color: #fff; }
.resume-creation { color: var(--encre-douce); font-size: 13px; }
.creation-etape { margin-top: 10px; }
.caracs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.carac { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--bord); border-radius: 8px; background: #fff8ec; }
.carac strong { font-size: 22px; }
.carac small { font-size: 12px; color: var(--encre-douce); font-weight: normal; }
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.carte-choix { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; border: 1px solid var(--bord); border-radius: 8px; background: #fff8ec; color: var(--encre); cursor: pointer; font-size: 13px; }
button.carte-choix:hover { border-color: var(--t-accent); }
.carte-choix strong { font-size: 15px; }
.carte-divinite { cursor: default; }
.carte-divinite ul { padding-left: 18px; margin: 6px 0; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-bottom: 12px; }
.case { display: flex; align-items: center; gap: 4px; }
.deja { color: var(--encre-douce); font-size: 13px; }
.creation-etape label { display: block; margin: 10px 0 4px; }
.creation-etape input[type=range] { width: 100%; max-width: 400px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; }
button.puce { padding: 3px 10px; border-radius: 12px; background: #e6dcc9; color: var(--encre); }
.creation button.retour { display: block; margin-top: 1rem; }
.meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
button.regenerer { margin-left: auto; padding: 2px 10px; font-size: 12px; background: transparent; border: 1px solid var(--bord); color: var(--encre-douce); border-radius: 6px; cursor: pointer; }
button.regenerer:hover:not(:disabled) { color: var(--encre); border-color: var(--encre-douce); }
details.ancienne { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--bord); color: var(--encre-douce); font-size: 0.95em; }
details.ancienne summary { cursor: pointer; font-family: system-ui, sans-serif; font-size: 12px; }
details.ancienne div { margin-top: 6px; }
.case .fiche-source { color: var(--encre-douce); }
.histoire p { line-height: 1.55; margin: 0 0 10px; }
.creation-attente { font-style: italic; color: var(--encre-douce); }
.creation .carte-choix select { max-width: 100%; margin-top: 4px; }
.fiche-texte { margin: 0 0 6px; font-size: 13px; }
.fiche-passe { margin-top: 12px; font-size: 13px; }
.fiche-passe summary { cursor: pointer; font-family: Georgia, serif; font-weight: bold; }
.fiche .hostile { color: #c0533a; }
.fiche .amical { color: #5f9a52; }
.aide button { margin-top: 8px; }
.journal-moteur { list-style: none; margin: 0 0 10px; padding: 8px 10px; background: rgba(0,0,0,0.05); border-radius: 6px; font-family: system-ui, sans-serif; font-size: 13px; white-space: normal; }
.journal-moteur li.ok { color: #3f6b35; }
.journal-moteur li.echec { color: #a8432c; }
.fiche .titre-combat { color: #e07a5f; }
.fiche li.vaincu { text-decoration: line-through; opacity: 0.6; }
.fiche .mort { color: #e07a5f; font-size: 0.7em; }
.choix-adresse { margin-bottom: 12px; padding: 10px 12px; border: 1px dashed var(--bord); border-radius: 8px; }
.fiche .neutre { color: #a89a85; }
#choix-defense[hidden] { display: none !important; }
#actions-combat { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 20px 0; }
#actions-combat[hidden] { display: none !important; }
#actions-combat button { background: #7a2e1f; border: 1px solid #e07a5f; color: var(--parchemin); }
#actions-combat button.discret { background: transparent; color: var(--t-doux); border-color: var(--t-bord); }
#actions-combat button:disabled { opacity: 0.5; }
.fiche button.mini { margin-left: 6px; padding: 1px 8px; font-size: 11px; background: transparent; border: 1px solid var(--t-bord); color: var(--t-doux); border-radius: 5px; cursor: pointer; }
.fiche button.mini:hover { color: var(--parchemin); border-color: var(--t-doux); }
.fiche .fiche-aide { color: var(--t-pale); font-size: 11px; margin: -2px 0 4px; }
.fiche .porte { color: #8fbf7a; font-size: 12px; }
.fenetre-fond { position: fixed; inset: 0; background: rgba(20, 14, 10, 0.7); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.fenetre { background: var(--parchemin); color: var(--encre); border-radius: 12px; padding: 18px 22px; width: min(860px, 100%); font-family: system-ui, sans-serif; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.fenetre-entete { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.fenetre-entete h2 { flex: 1; margin: 0; font-family: Georgia, serif; }
.fenetre button.discret { border-color: var(--bord); color: var(--encre); }
table.boutique { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
table.boutique td { padding: 5px 6px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
table.boutique td.prix { white-space: nowrap; text-align: right; font-weight: 600; }
table.boutique td:last-child { width: 1%; }
table.boutique .fiche-aide { color: var(--encre-douce); }
.fenetre .succes { color: #3f6b35; margin: 4px 0; }
.bouton-boutiques { width: 100%; margin-top: 8px; }
.bouton-niveau { width: 100%; margin: 6px 0; background: #b8892b; border-color: #e0b24f; }
.fenetre select { font-size: 14px; padding: 4px; margin-top: 4px; }
table.boutique tr.trop-cher td { opacity: 0.55; }

/* ---------- Téléphone et petits écrans ---------- */
#bouton-fiche { display: none; }
@media (max-width: 760px) {
  header { padding: 8px 10px; gap: 6px; }
  .titre { display: flex; align-items: center; gap: 8px; width: 100%; }
  h1 { font-size: 20px; }
  .sous-titre { display: none; }
  #bouton-fiche { display: inline-block; padding: 4px 10px; }
  .reglages { flex-wrap: wrap; gap: 6px; font-size: 13px; width: 100%; }
  .reglages label { display: none; }
  .reglages select { flex: 1 1 40%; min-width: 0; }
  #depenses { order: 10; width: 100%; font-size: 11px; }
  header button { padding: 6px 10px; }
  /* La fiche : cachée, ouverte par-dessus le jeu avec le bouton « Fiche » */
  #corps { position: relative; }
  #fiche { display: none; }
  body.fiche-ouverte #fiche:not([hidden]) { display: block; position: absolute; inset: 0; z-index: 20; width: 100%; max-width: none; overflow-y: auto; }
  main { padding: 10px; }
  .message { padding: 10px 12px; }
  .message.joueur { max-width: 92%; }
  /* Zone de saisie : la défense passe au-dessus, en ligne */
  #saisie { flex-wrap: wrap; padding: 8px; gap: 6px; }
  #message { flex: 1 1 70%; min-width: 0; }
  #actions-combat { padding: 6px 8px 0; gap: 6px; }
  #actions-combat button { padding: 6px 10px; font-size: 13px; }
  .fenetre-fond { padding: 8px; }
  .fenetre { padding: 12px; }
  .creation { padding: 12px; }
  .cartes { grid-template-columns: 1fr !important; }
}

/* ---------- Encarts de la fiche : repliables et déplaçables ---------- */
#fiche { width: 320px; }
.fiche-blocs { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.bloc { background: var(--t-bloc); border: 1px solid var(--t-bloc-bord); border-radius: 8px; }
.bloc-entete { display: flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; user-select: none; }
.bloc-entete h3 { flex: 1; margin: 0; }
.bloc-entete:hover h3 { color: var(--parchemin); }
.bloc .fleche { color: var(--t-pale); font-size: 12px; }
.bloc .poignee { cursor: grab; color: var(--t-bord); font-size: 16px; line-height: 1; padding: 0 2px; }
.bloc .poignee:hover { color: var(--t-doux); }
.bloc-corps { padding: 2px 10px 10px; }
.bloc.replie .bloc-corps { display: none; }
.bloc.en-deplacement { opacity: 0.5; outline: 2px dashed var(--t-doux); }
.bloc-combat { border-color: #e07a5f; }
.bloc-combat h3 { color: #e07a5f; }
.fiche-liste.aptitudes { margin-top: 6px; color: var(--t-doux); font-style: italic; }
.fiche .accords { margin: 2px 0 4px; padding-left: 16px; list-style: none; font-size: 12px; color: var(--t-doux); }
.fiche .connaissances > li { margin-bottom: 3px; }
.fiche .quete-finie { opacity: 0.6; }
.fiche .connaissances { list-style: none; padding-left: 2px; }

/* ---------- Colonne de droite (activable) ---------- */
#bouton-colonne { margin-right: 6px; padding: 4px 10px; font-size: 13px; }
#bouton-colonne.actif { border-color: var(--t-doux); color: var(--parchemin); }
#fiche-droite { width: 320px; flex-shrink: 0; overflow-y: auto; padding: 16px; background: var(--t-panneau); color: var(--parchemin); font-family: system-ui, sans-serif; font-size: 14px; }
#fiche-droite .fiche-blocs { min-height: 200px; margin-top: 0; }
.colonne-vide { color: var(--t-bord); font-size: 12px; text-align: center; border: 1px dashed var(--t-bloc-bord); border-radius: 8px; padding: 14px 8px; margin: 0; }
.fiche-blocs .bloc ~ .colonne-vide, .fiche-blocs .colonne-vide:not(:only-child) { display: none; }
@media (max-width: 760px) {
  #bouton-colonne, #fiche-droite { display: none !important; }
}

/* ---------- Polices du récit (libres, licence SIL OFL : voir polices/licences) ----------
   Le narrateur parle dans une police neutre ; chaque PNJ dans la police de sa race. */
@font-face { font-family: "AWEN Narrateur"; src: url("polices/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Humain"; src: url("polices/eb-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Humain"; src: url("polices/eb-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "AWEN Nain"; src: url("polices/cinzel-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Barbare"; src: url("polices/uncial-antiqua-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Elfe"; src: url("polices/cormorant-garamond-latin-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "AWEN Elfe Noir"; src: url("polices/grenze-gotisch-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Orque"; src: url("polices/pirata-one-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Creature"; src: url("polices/metamorphous-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Gobelin"; src: url("polices/henny-penny-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Semi-Homme"; src: url("polices/kalam-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "AWEN Gnome"; src: url("polices/patrick-hand-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
.message.mj { font-family: "AWEN Narrateur", system-ui, sans-serif; font-size: 15px; color: #3b3128; }
/* Paroles des PNJ : non marquées = style dialogue par défaut */
.parole { font-family: "AWEN Humain", Georgia, serif; font-style: italic; color: #2b2118; font-size: 1.05em; }
.parole-humain { font-family: "AWEN Humain", Georgia, serif; font-style: normal; font-weight: 500; color: #3a2a1a; }
.parole-demi-elfe { font-family: "AWEN Humain", Georgia, serif; font-style: italic; color: #1f4d4b; }
.parole-nain { font-family: "AWEN Nain", Georgia, serif; font-style: normal; font-weight: 700; color: #5a2e0e; font-size: 0.98em; letter-spacing: 0.02em; }
.parole-barbare { font-family: "AWEN Barbare", Georgia, serif; font-style: normal; color: #6e1a12; }
.parole-haut-elfe { font-family: "AWEN Elfe", Georgia, serif; font-style: italic; font-weight: 600; color: #1d2f7a; font-size: 1.15em; }
.parole-elfe-sylvain { font-family: "AWEN Elfe", Georgia, serif; font-style: italic; font-weight: 600; color: #24521c; font-size: 1.15em; }
.parole-elfe-noir { font-family: "AWEN Elfe Noir", Georgia, serif; font-style: normal; color: #3c1656; font-size: 1.1em; }
.parole-orque { font-family: "AWEN Orque", Georgia, serif; font-style: normal; color: #3f4410; font-size: 1.15em; letter-spacing: 0.03em; }
.parole-demi-orque { font-family: "AWEN Orque", Georgia, serif; font-style: normal; color: #2f4238; font-size: 1.1em; }
.parole-ogre { font-family: "AWEN Orque", Georgia, serif; font-style: normal; font-weight: 700; color: #4a3828; font-size: 1.25em; text-transform: uppercase; letter-spacing: 0.04em; }
.parole-gobelin { font-family: "AWEN Gobelin", Georgia, serif; font-style: normal; color: #4f5c08; font-size: 0.98em; }
.parole-semi-homme { font-family: "AWEN Semi-Homme", Georgia, serif; font-style: normal; color: #6a4a12; font-size: 1.05em; }
.parole-gnome { font-family: "AWEN Gnome", Georgia, serif; font-style: normal; color: #7a2a1c; font-size: 1.1em; }
.parole-creature { font-family: "AWEN Creature", Georgia, serif; font-style: italic; color: #4a2f4a; }
.parole[title] { cursor: help; }

/* Bouton de la colonne de droite (coin supérieur droit de la fiche) et éléments avec aide au survol */
.fiche { position: relative; }
.fiche .bouton-colonne { position: absolute; top: 0; right: 0; padding: 2px 8px; font-size: 16px; line-height: 1.2; background: transparent; border: 1px solid var(--t-bord); color: var(--t-doux); border-radius: 6px; }
.fiche .bouton-colonne:hover, .fiche .bouton-colonne.actif { color: var(--parchemin); border-color: var(--t-doux); background: var(--t-bloc); }
.fiche h2 { padding-right: 36px; }
.fiche .fiche-ligne[title]:not([title=""]) span, .fiche .avec-aide { cursor: help; text-decoration: underline dotted rgba(255,255,255,0.25); text-underline-offset: 3px; }
@media (max-width: 760px) { .fiche .bouton-colonne { display: none; } }

/* « Précédemment… » quand on rouvre une partie */
.precedemment { margin: 12px auto; max-width: 640px; padding: 10px 14px; border: 1px dashed var(--t-bord); border-radius: 8px; background: var(--t-bloc); color: var(--t-doux); font-style: italic; }
.precedemment strong { display: block; font-style: normal; color: var(--parchemin); margin-bottom: 4px; }
.precedemment p { margin: 0; }

/* Le Carnet et les Épinglés */
.carnet .onglets { display: flex; gap: 4px; margin-bottom: 6px; }
.carnet .onglet { flex: 1; padding: 3px 6px; font-size: 12px; background: transparent; border: 1px solid var(--t-bord); color: var(--t-doux); border-radius: 6px; }
.carnet .onglet.actif { background: var(--t-bloc); color: var(--parchemin); border-color: var(--t-doux); }
.recherche-carnet { width: 100%; box-sizing: border-box; font-size: 13px; padding: 4px 8px; margin-bottom: 6px; border-radius: 6px; border: 1px solid var(--t-bord); background: rgba(255,255,255,0.06); color: inherit; }
.carnet-corps details.noeud { margin: 2px 0 2px 2px; }
.carnet-corps details.noeud > details.noeud, .carnet-corps details.noeud > ul { margin-left: 14px; }
.carnet-corps summary { cursor: pointer; padding: 1px 0; }
.lien-carnet { background: none; border: none; padding: 0; margin: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted rgba(255,255,255,0.3); text-underline-offset: 3px; }
.lien-carnet:hover { color: var(--parchemin); text-decoration-color: currentColor; }
.ligne-carnet { display: flex; align-items: baseline; gap: 4px; }
.ligne-carnet .ligne-texte { flex: 1; min-width: 0; }
button.epingler { background: none; border: none; padding: 0 2px; font-size: 12px; cursor: pointer; opacity: 0.25; filter: grayscale(1); }
button.epingler:hover, button.epingler.actif { opacity: 1; filter: none; }
.carnet-section { margin: 8px 0 2px; font-size: 13px; color: var(--t-doux); }
.fiche-titre { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0; }
.carnet .info { margin: 3px 0; font-size: 13px; }
.carnet .info-libelle { color: var(--t-pale); }
.retour-carnet { font-size: 12px; padding: 1px 8px; margin-bottom: 4px; }
.urgent { color: #e8873a; font-weight: bold; }
.ici { color: var(--t-accent); font-size: 12px; font-weight: bold; }
.epingles li { padding: 2px 0; }

/* Panneaux d'annonces */
.fenetre .annonce { border: 1px solid var(--bord); border-radius: 8px; padding: 8px 12px; margin: 6px 0; background: rgba(255,255,255,0.35); }
.fenetre .annonce p { margin: 4px 0; }
.fenetre .annonce-titre { display: flex; justify-content: space-between; gap: 12px; }
.fenetre .annonce-prime { white-space: nowrap; font-weight: bold; }
.fenetre ul.guildes li { margin: 6px 0; }

/* Charge et encarts d'animaux */
.charge { font-size: 12px; color: var(--t-doux); margin: 0 0 4px; }
.charge.surcharge { color: #e8873a; font-weight: bold; }

/* Bandeau de scène (en haut de la discussion) */
#scene { position: sticky; top: -20px; z-index: 5; max-width: 820px; margin: -20px auto 14px; padding: 8px 10px; background: rgba(20, 15, 12, 0.82); backdrop-filter: blur(6px); border-bottom: 1px solid var(--t-bord); border-radius: 0 0 10px 10px; }
#scene[hidden] { display: none; }
#scene.en-combat { border-bottom-color: #e07a5f; }
.scene-entete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--t-doux); cursor: pointer; }
.scene-cartes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.carte-scene { flex: 1 1 170px; max-width: 260px; display: flex; flex-direction: column; gap: 3px; padding: 7px 9px; border: 1px solid var(--t-bord); border-radius: 8px; background: var(--t-bloc); font-size: 13px; color: var(--parchemin); font-family: system-ui, sans-serif; }
.carte-scene small { font-size: 12px; }
.carte-scene .fiche-aide { color: var(--t-doux); }
.scene-entete { font-family: system-ui, sans-serif; }
.carte-scene .carte-titre { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; font-weight: bold; }
.carte-scene .carte-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.carte-scene button.mini { align-self: flex-start; padding: 2px 10px; font-size: 12px; }
.carte-scene button.mini.danger { background: #7a2e1f; border: 1px solid #e07a5f; color: var(--parchemin); }
.carte-scene.adversaire { border-color: #a0503a; }
.carte-scene.vaincu { opacity: 0.45; }
.carte-scene.piege { border-color: #e8873a; }
.carte-scene .jauge { height: 5px; background: rgba(224,122,95,0.25); border-radius: 3px; }
.carte-scene .jauge > div { height: 5px; background: #e07a5f; border-radius: 3px; transition: width 0.4s; }
.carte-scene .amical { color: #8fd18f; } .carte-scene .hostile { color: #e07a5f; } .carte-scene .neutre { color: var(--t-doux); }
.carte-scene.apparition { animation: apparition 0.35s ease-out; }
@keyframes apparition { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  #scene { top: -10px; margin: -10px -10px 10px; border-radius: 0; }
  .scene-cartes { flex-wrap: nowrap; overflow-x: auto; }
  .carte-scene { flex: 0 0 180px; }
}

/* Décor : fond de la discussion selon le lieu (image ou dégradé) et le moment (voile de couleur) */
main { --voile: rgba(20, 14, 10, 0.35); --decor-fond: none; background-color: var(--t-fond); background-image: linear-gradient(var(--voile), var(--voile)), var(--decor-image, var(--decor-fond)); background-size: cover; background-position: center; background-attachment: local, fixed; transition: background-color 0.6s; }
main[data-zone="ville"] { --decor-fond: linear-gradient(180deg, #5a4a3a, #2e2620); }
main[data-zone="village"] { --decor-fond: linear-gradient(180deg, #5d5a3a, #2c2a1c); }
main[data-zone="interieur"] { --decor-fond: radial-gradient(ellipse at 50% 30%, #6b4426, #241812 70%); }
main[data-zone="route"] { --decor-fond: linear-gradient(180deg, #6b6450, #3a3326); }
main[data-zone="campagne"] { --decor-fond: linear-gradient(180deg, #627048, #2e3622); }
main[data-zone="foret"] { --decor-fond: linear-gradient(180deg, #2f4a2c, #141f13); }
main[data-zone="montagne"] { --decor-fond: linear-gradient(180deg, #6a7078, #2c3036); }
main[data-zone="marais"] { --decor-fond: linear-gradient(180deg, #4a5238, #1f2418); }
main[data-zone="souterrain"] { --decor-fond: radial-gradient(ellipse at 50% 20%, #3a3530, #0f0d0c 75%); }
main[data-zone="donjon"] { --decor-fond: linear-gradient(180deg, #3d3a40, #151418); }
main[data-zone="cote"] { --decor-fond: linear-gradient(180deg, #4f7488, #26343a); }
main[data-zone="desert"] { --decor-fond: linear-gradient(180deg, #a08050, #4a3a22); }
main[data-moment="jour"] { --voile: rgba(20, 14, 10, 0.30); }
main[data-moment="aube"] { --voile: rgba(120, 70, 90, 0.40); }
main[data-moment="crepuscule"] { --voile: rgba(130, 60, 20, 0.45); }
main[data-moment="nuit"] { --voile: rgba(8, 14, 40, 0.68); }
main[data-moment="propre"] { --voile: rgba(10, 8, 6, 0.30); }

.carte-scene.compagnon { border-color: #5f8f5a; }
.carte-scene .jauge.compagnon { background: rgba(120, 190, 110, 0.25); }
.carte-scene .jauge.compagnon > div { background: #7fbf6f; }

/* Dernier point de destin et héritier */
.destin-fond { align-items: center; }
.fenetre.destin { width: min(640px, 100%); text-align: center; }
.destin-choix { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; text-align: left; }
.destin-choix button { width: 100%; font-size: 16px; padding: 10px; }
.destin-choix p { font-size: 14px; margin: 6px 0 0; }
@media (max-width: 600px) { .destin-choix { grid-template-columns: 1fr; } }
.heritage-bandeau { border: 1px solid var(--bord, #8a6d3b); border-radius: 8px; padding: 10px 14px; margin: 8px 0; background: rgba(0,0,0,0.15); }
.heritage-bandeau p { margin: 4px 0; }
.heritage-detail { font-size: 14px; opacity: 0.9; }

/* Bandeau de scène : croix pour fermer un élément du décor */
.carte-scene { position: relative; }
.carte-scene .fermer-carte { position: absolute; top: 2px; right: 4px; background: none; border: none; color: inherit; opacity: 0.5; cursor: pointer; font-size: 12px; padding: 0 2px; line-height: 1; }
.carte-scene .fermer-carte:hover { opacity: 1; }
.carte-scene .fermer-carte + .carte-titre { padding-right: 14px; }

/* ---------- Barres de défilement aux couleurs de la race ----------
   --sb-pouce : le curseur (couleur ou dégradé), --sb-piste : le rail, --sb-rayon : sa forme,
   --sb-l : son épaisseur, --sb-bord : son contour. Chaque race a sa « matière » (bouton ✦ sobre : couleurs seules). */
:root { --sb-l: 10px; --sb-rayon: 6px; --sb-pouce: var(--t-bord); --sb-piste: var(--t-fond); --sb-bord: 2px solid var(--t-fond); }
::-webkit-scrollbar { width: var(--sb-l); height: var(--sb-l); }
::-webkit-scrollbar-track { background: var(--sb-piste); }
::-webkit-scrollbar-thumb { background: var(--sb-pouce); border-radius: var(--sb-rayon); border: var(--sb-bord); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { filter: brightness(1.25); background-color: var(--t-accent); }
::-webkit-scrollbar-corner { background: var(--sb-piste); }
/* Firefox (pas de forme possible : seulement les couleurs) */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--t-bord) var(--t-fond); }
}
body.deco-sobre { --sb-pouce: var(--t-bord); --sb-rayon: 6px; --sb-l: 10px; --sb-bord: 2px solid var(--t-fond); }
/* Nain : acier riveté, angles droits */
body:not(.deco-sobre)[data-race="nain"], body:not(.deco-sobre)[data-race="demi-elfe-nain"], body:not(.deco-sobre)[data-race="nain-mafia"] { --sb-rayon: 1px; --sb-pouce: radial-gradient(circle at 50% 6px, #d8cfc4 1.5px, transparent 2px), radial-gradient(circle at 50% calc(100% - 6px), #d8cfc4 1.5px, transparent 2px), linear-gradient(90deg, #4e4740, #8a8178 45%, #5d554d); --sb-bord: 1px solid #2b2621; --sb-l: 11px; }
/* Humain : bois verni */
body:not(.deco-sobre)[data-race="humain"] { --sb-rayon: 4px; --sb-pouce: repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 2px, transparent 2px 7px), linear-gradient(90deg, #5e4a30, #9a7b4a 50%, #6e5638); --sb-bord: 1px solid #3a2f22; }
/* Barbare : cuir cousu */
body:not(.deco-sobre)[data-race="barbare"], body:not(.deco-sobre)[data-race="amazone"] { --sb-rayon: 5px; --sb-pouce: linear-gradient(90deg, #5a2219, #8a3a2c 50%, #5a2219); --sb-bord: 1px dashed #e0b8a8; --sb-l: 11px; }
/* Haut Elfe : argent et saphir, en pilule */
body:not(.deco-sobre)[data-race="haut-elfe"], body:not(.deco-sobre)[data-race="demi-haut-elfe"] { --sb-rayon: 10px; --sb-pouce: linear-gradient(90deg, #8794bd, #e6ecff 50%, #4c5e9c); --sb-bord: 2px solid #18213f; }
/* Demi-Elfe : sarcelle polie */
body:not(.deco-sobre)[data-race="demi-elfe"] { --sb-rayon: 10px; --sb-pouce: linear-gradient(90deg, #2f6b68, #8fc4bf 50%, #2f6b68); --sb-bord: 2px solid #19292b; }
/* Elfe Sylvain : tige de lierre */
body:not(.deco-sobre)[data-race="elfe-sylvain"], body:not(.deco-sobre)[data-race="demi-sylvain"] { --sb-rayon: 10px; --sb-pouce: radial-gradient(ellipse 3px 5px at 30% 30%, #8fbf6a 60%, transparent 62%), radial-gradient(ellipse 3px 5px at 70% 70%, #8fbf6a 60%, transparent 62%), linear-gradient(90deg, #2c442e, #4f7350 50%, #2c442e); --sb-bord: 2px solid #1a2a1c; }
/* Elfe Noir : obsidienne fine qui luit */
body:not(.deco-sobre)[data-race="elfe-noir"], body:not(.deco-sobre)[data-race="demi-elfe-noir"] { --sb-l: 8px; --sb-rayon: 8px; --sb-pouce: linear-gradient(90deg, #1d1627, #6a2d8c 50%, #1d1627); --sb-bord: 1px solid #9a6cc0; }
/* Orque : fer rouillé */
body:not(.deco-sobre)[data-race="orque"] { --sb-rayon: 0; --sb-pouce: radial-gradient(circle at 30% 20%, rgba(150,70,20,.6) 2px, transparent 3px), radial-gradient(circle at 70% 75%, rgba(150,70,20,.5) 2px, transparent 3px), linear-gradient(90deg, #383d29, #6b6a3a 50%, #383d29); --sb-bord: 1px solid #1a1c12; --sb-l: 12px; }
/* Demi-Orque : ardoise */
body:not(.deco-sobre)[data-race="demi-orque"], body:not(.deco-sobre)[data-race="homme-bete"] { --sb-rayon: 2px; --sb-pouce: linear-gradient(90deg, #343e40, #6f8084 50%, #343e40); --sb-bord: 1px solid #15191a; }
/* Gobelin : bricolage vert acide, forme de travers */
body:not(.deco-sobre)[data-race="gobelin"], body:not(.deco-sobre)[data-race="demi-gobelin"] { --sb-rayon: 3px 9px 4px 10px; --sb-pouce: repeating-linear-gradient(45deg, #7c8f12 0 6px, #5f6e0e 6px 12px); --sb-bord: 1px solid #15180d; }
/* Ogre : gros caillou */
body:not(.deco-sobre)[data-race="ogre"], body:not(.deco-sobre)[data-race="demi-ogre-elfique"] { --sb-l: 13px; --sb-rayon: 6px 3px 7px 4px; --sb-pouce: radial-gradient(circle at 35% 30%, #8d847a, #5a524b 70%); --sb-bord: 2px solid #1a1816; }
/* Semi-Homme : pain d'épice */
body:not(.deco-sobre)[data-race="semi-homme"], body:not(.deco-sobre)[data-race="semi-elfe"] { --sb-rayon: 8px; --sb-pouce: radial-gradient(circle at 50% 30%, #f4ecc8 1px, transparent 1.5px), radial-gradient(circle at 50% 70%, #f4ecc8 1px, transparent 1.5px), linear-gradient(90deg, #6e521c, #b08a3a 50%, #6e521c); --sb-bord: 2px solid #2a2817; }
/* Gnôme des forêts du Nord : amanite tue-mouches */
body:not(.deco-sobre)[data-race="gnome-forets-nord"] { --sb-rayon: 10px; --sb-pouce: radial-gradient(circle at 35% 25%, #fff 1.5px, transparent 2px), radial-gradient(circle at 65% 55%, #fff 1.5px, transparent 2px), radial-gradient(circle at 40% 80%, #fff 1.2px, transparent 1.7px), linear-gradient(90deg, #7a2a1a, #c8503a 50%, #7a2a1a); --sb-bord: 2px solid #1c2528; }

/* Chronique : un chapitre par grande étape */
.fiche .chapitre { margin: 4px 0; }
.fiche .chapitre summary { cursor: pointer; font-size: 13px; padding: 2px 0; }
.fiche .chapitre.en-cours summary { opacity: 0.75; font-style: italic; }
.fiche .chapitre p { margin: 4px 0 8px; }
.alerte-texte { color: #c0392b; }

/* ---------- Barre du bas alignée sur les colonnes : interrupteur de défense | saisie | Décrire + Envoyer ---------- */
#saisie { display: grid; grid-template-columns: 320px minmax(0, 1fr) 320px; gap: 0; padding: 0; align-items: stretch; }
#saisie > #choix-defense, #saisie > .boutons-saisie { margin: 12px 16px; }
#saisie > textarea { margin: 12px 0; }
/* Interrupteur coulissant : un curseur qui glisse de « Parade » à « Esquive » */
#choix-defense {
  position: relative; display: flex; flex-direction: row; gap: 0; align-items: stretch; padding: 4px; min-height: 48px;
  border: 1px solid var(--t-bord); border-radius: 999px; background: rgba(0, 0, 0, 0.3);
  color: var(--parchemin); font: 600 14px system-ui, sans-serif; cursor: pointer;
}
#choix-defense::before {
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 999px; background: var(--t-accent, #a0522d); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease;
}
#choix-defense[aria-checked="true"]::before { transform: translateX(100%); }
#choix-defense .cote-defense { position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; opacity: 0.6; transition: opacity 0.25s; }
#choix-defense[aria-checked="false"] .cote-defense[data-valeur="parade"],
#choix-defense[aria-checked="true"] .cote-defense[data-valeur="esquive"] { opacity: 1; }
#choix-defense .legende-defense {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 0 6px;
  font-size: 10px; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  background: var(--t-panneau); color: var(--t-doux); border-radius: 4px;
}
/* Hors combat : grisé (on peut quand même le régler à l'avance) */
#choix-defense:not(.en-combat) { filter: grayscale(0.7); opacity: 0.6; }
#choix-defense.en-combat { border-color: #e07a5f; }
#choix-defense.en-combat .legende-defense { color: #e07a5f; }
.boutons-saisie { display: flex; gap: 8px; }
.boutons-saisie button { flex: 1; }
#observer { background: transparent; border: 1px solid var(--t-bord); color: var(--parchemin); }
#observer:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
#observer:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 760px) {
  #saisie { grid-template-columns: 1fr; padding: 6px 8px; }
  #saisie > #choix-defense, #saisie > .boutons-saisie, #saisie > textarea { margin: 4px 0; }
  #choix-defense { min-height: 38px; }
}
#observer.fuir { background: #8e2b1e; border-color: #c0392b; color: #fff; }
#observer.fuir:hover { background: #a83524; }

/* ---------- Administration ---------- */
.page-admin { display: block; overflow-y: auto; background: var(--t-fond); color: var(--parchemin); font-family: system-ui, sans-serif; }
.page-admin header .reglages { display: flex; align-items: center; gap: 12px; }
.badge-maintenance { background: #a3301f; color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 13px; }
.onglets-admin { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 20px 0; background: var(--t-panneau); border-bottom: 1px solid var(--t-bord); }
.onglets-admin button { background: transparent; color: var(--t-doux); border-radius: 8px 8px 0 0; }
.onglets-admin button.actif { background: var(--t-fond); color: var(--parchemin); font-weight: 600; }
.contenu-admin { max-width: 1150px; margin: 0 auto; padding: 20px; overflow: visible; }
.contenu-admin .alerte { max-width: none; }
.succes { margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; background: #d8efd9; color: #1d5b24; font-size: 14px; }
.carte-admin { background: var(--t-panneau); border: 1px solid var(--t-bloc-bord); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.carte-admin h2 { margin: 0 0 12px; font-size: 18px; font-family: Georgia, serif; }
.carte-admin h3 { margin: 18px 0 8px; font-size: 15px; }
.aide-admin { color: var(--t-pale); font-size: 13px; margin: 6px 0; }
.ligne-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ligne-form input[type="text"], .ligne-form input:not([type]), .ligne-form input[type="password"] { flex: 1; min-width: 200px; }
.page-admin input { padding: 7px 10px; }
.page-admin input[type="number"] { width: 100px; }
.page-admin label { color: var(--t-doux); }
.case { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.cases { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 10px 20px; }
.form-quota { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.page-admin button.rouge { background: #8f2a1c; }
.page-admin button.vert { background: #2f6b32; }
.page-admin button.petit { padding: 4px 8px; background: var(--t-bouton2); }
.page-admin button.petit.rouge { background: #6e2318; }
.table-admin { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-admin th { text-align: left; color: var(--t-pale); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--t-bord); }
.table-admin td { padding: 6px 8px; border-bottom: 1px solid var(--t-bloc-bord); vertical-align: middle; }
.table-admin td.actions { white-space: nowrap; text-align: right; }
.table-admin td.actions button + button { margin-left: 4px; }
.table-admin tr.suspendu td { opacity: 0.55; }
.table-admin tr.sous-ligne td { background: var(--t-bloc); padding: 12px; }
.table-admin code { font-size: 12px; color: var(--t-doux); }
.table-admin select { width: 100%; }
.etiquette { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-size: 11px; background: var(--t-accent); color: #fff; vertical-align: middle; }
.etiquette.rouge { background: #8f2a1c; }
.grille-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.chiffre { background: var(--t-panneau); border: 1px solid var(--t-bloc-bord); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.chiffre strong { font-size: 26px; font-family: Georgia, serif; }
.chiffre span { color: var(--t-pale); font-size: 13px; }
.jauge { height: 6px; border-radius: 3px; background: var(--t-champ); overflow: hidden; margin-top: 6px; }
.jauge .plein { height: 100%; background: #4f8a3c; }
.jauge .plein.alerte-jauge { background: #b8402a; }
.barres { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.barre { flex: 1; max-width: 60px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; font-size: 11px; color: var(--t-pale); }
.barre .valeur { width: 100%; min-height: 2px; background: var(--t-accent); border-radius: 4px 4px 0 0; }
.resultat-cle .ok, .page-admin .ok { color: #8fd18f; }
.resultat-cle .ko, .page-admin .ko { color: #ff9b8a; }
.journal td:first-child { white-space: nowrap; }
.journal tr.journal-echec td, .journal tr.journal-blocage td { color: #f0c27a; }
.journal tr.journal-ia td, .journal tr.journal-erreur td { color: #ff9b8a; }
.journal tr.journal-admin td { color: #9fc4ff; }
.carte-maintenance p { line-height: 1.5; text-align: center; }
.page-admin main.contenu-admin { background: none; }

/* Liens présentés comme des boutons */
a.bouton { display: inline-block; padding: 8px 14px; border-radius: 6px; text-decoration: none; font-family: system-ui, sans-serif; white-space: nowrap; background: var(--t-accent); color: #fff; }
a.bouton.discret { background: transparent; border: 1px solid var(--t-bord); color: var(--t-doux); }
a.bouton.discret .compte { color: var(--parchemin); }
a.bouton:hover { filter: brightness(1.15); }

/* ---------- Mes personnages ---------- */
.galerie-persos { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.carte-perso {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 170px; padding: 18px 18px 14px;
  border-radius: 12px; cursor: pointer; background: var(--t-panneau); border: 1px solid var(--t-bloc-bord);
  border-left: 6px solid var(--t-accent); color: var(--parchemin); transition: transform 0.12s, box-shadow 0.12s;
}
.carte-perso:hover, .carte-perso:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); outline: none; }
.carte-perso h2 { margin: 0; font-family: Georgia, serif; font-size: 21px; padding-right: 34px; }
.carte-perso .infos-perso { margin: 0; color: var(--t-doux); }
.carte-perso .lieu-perso { margin: 0; color: var(--t-pale); font-size: 14px; }
.carte-perso .pied-perso { margin: auto 0 0; padding-top: 10px; display: flex; justify-content: space-between; gap: 8px; color: var(--t-pale); font-size: 12px; border-top: 1px solid var(--t-bloc-bord); }
.carte-perso.recente { box-shadow: 0 0 0 2px var(--t-accent); }
.carte-perso.morte { filter: grayscale(0.6); }
.carte-perso .badge-continuer { align-self: flex-start; padding: 2px 8px; border-radius: 4px; background: var(--t-accent); color: #fff; font-size: 12px; }
.carte-perso .supprimer-perso { position: absolute; top: 10px; right: 10px; opacity: 0.4; background: transparent; border: none; }
.carte-perso:hover .supprimer-perso { opacity: 1; }
.carte-nouveau { align-items: center; justify-content: center; text-align: center; border: 2px dashed var(--t-bord); border-left-width: 2px; background: transparent; }
.carte-nouveau h2 { padding: 0; }
.carte-nouveau .plus { font-size: 42px; line-height: 1; color: var(--t-doux); }
.barre .valeur.perso { background: #d9a35a; border-radius: 4px 4px 0 0; }
.barre .valeur.perso + .valeur { border-radius: 0; }
@media (max-width: 760px) {
  .page-admin header .reglages { flex-wrap: wrap; }
  .table-admin { font-size: 12px; }
}
/* Réglages visibles mais bloqués (sans clé personnelle) */
.carte-admin.verrouille { opacity: 0.45; filter: grayscale(0.7); pointer-events: none; user-select: none; }
.bandeau-verrou { margin: 0 0 12px; padding: 10px 14px; border-radius: 8px; border: 1px dashed var(--t-bord); color: var(--t-doux); text-align: center; }
.carte-perso .caracs-perso { display: flex; gap: 6px; margin-top: 4px; }
.carte-perso .caracs-perso span { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 4px 2px; border-radius: 6px; background: var(--t-bloc); border: 1px solid var(--t-bloc-bord); }
.carte-perso .caracs-perso small { font-size: 10px; letter-spacing: 1px; color: var(--t-pale); }
.carte-perso .caracs-perso strong { font-size: 16px; font-family: Georgia, serif; }
.carte-perso .mj-perso { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--t-pale); cursor: default; }
.carte-perso .mj-perso select { flex: 1; min-width: 0; padding: 3px 6px; font-size: 13px; }
.depenses-entete { color: var(--t-doux); font-size: 13px; }
/* Premier écran d'une partie : le bouton « Commencer l'aventure », en grand, au milieu */
.aide.depart { min-height: calc(100vh - 230px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 24px; }
.aide.depart p { margin: 0; max-width: 560px; font-size: 17px; }
.bouton-depart { font-size: 30px; padding: 18px 44px; border-radius: 12px; font-family: Georgia, serif; font-style: normal; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); transition: transform 0.12s, filter 0.12s; }
.bouton-depart:hover { transform: scale(1.04); filter: brightness(1.12); }
@media (max-width: 760px) { .bouton-depart { font-size: 22px; padding: 14px 28px; } }
/* Le titre d'un encart sert aussi de poignée pour le déplacer */
.bloc .poignee-titre { cursor: grab; user-select: none; }
.bloc .poignee-titre:active { cursor: grabbing; }
.fiche-blocs .bloc[draggable="true"] { cursor: grab; }
.fiche-blocs .bloc[draggable="true"] button, .fiche-blocs .bloc[draggable="true"] a, .fiche-blocs .bloc[draggable="true"] input { cursor: pointer; }
.fiche-blocs .bloc[draggable="true"]:active { cursor: grabbing; }

/* ---------- Petit tutoriel ---------- */
.tuto-voile { position: fixed; inset: 0; z-index: 1000; background: transparent; }
.tuto-voile.sombre { background: rgba(0, 0, 0, 0.65); }
.tuto-trou { position: fixed; z-index: 1001; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), 0 0 0 3px #e8b04a; transition: all 0.25s ease; }
.tuto-bulle {
  position: fixed; z-index: 1002; width: min(380px, calc(100vw - 16px)); padding: 16px 18px 14px; border-radius: 12px;
  background: var(--parchemin); color: var(--encre); font-family: system-ui, sans-serif; font-size: 14px; line-height: 1.5;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55); transition: left 0.25s ease, top 0.25s ease;
}
.tuto-bulle.centre { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
.tuto-bulle h3 { margin: 2px 0 6px; font-family: Georgia, serif; font-size: 18px; }
.tuto-bulle p { margin: 0 0 10px; }
.tuto-compteur { font-size: 11px; color: var(--encre-douce); letter-spacing: 1px; }
.tuto-boutons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.tuto-boutons button.discret { color: var(--encre-douce); border-color: #c9b79c; }
.tuto-boutons button.discret:first-child { margin-right: auto; border: none; text-decoration: underline; padding-left: 0; }
.tuto-fleche { position: absolute; width: 0; height: 0; border: 9px solid transparent; }
.tuto-bulle.centre .tuto-fleche { display: none; }
.tuto-bulle.cote-droite .tuto-fleche { left: -18px; border-right-color: var(--parchemin); transform: translateY(-50%); }
.tuto-bulle.cote-gauche .tuto-fleche { right: -18px; border-left-color: var(--parchemin); transform: translateY(-50%); }
.tuto-bulle.cote-dessous .tuto-fleche { top: -18px; border-bottom-color: var(--parchemin); transform: translateX(-50%); }
.tuto-bulle.cote-dessus .tuto-fleche { bottom: -18px; border-top-color: var(--parchemin); transform: translateX(-50%); }
.tuto-cartes { margin: 4px 0 10px; }
.tuto-cartes .carte-scene { flex: 1 1 150px; font-size: 12px; }
.tuto-cartes .faux-bouton { display: inline-block; padding: 2px 8px; border-radius: 5px; background: var(--t-accent); color: #fff; font-size: 11px; }
.tuto-bulle:has(.tuto-cartes) { width: min(560px, calc(100vw - 16px)); }
/* Sorts rangés par famille dans l'encart Magie */
.groupe-sorts { margin-top: 8px; padding-left: 8px; border-left: 3px solid var(--t-bord); }
.groupe-sorts.sorts-generale { border-left-color: #8fa4d9; }
.groupe-sorts.sorts-specialite { border-left-color: #d98f4f; }
.groupe-sorts.sorts-prodige { border-left-color: #e3c55a; }
.titre-groupe-sorts { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--parchemin); }
.titre-groupe-sorts small { font-weight: normal; color: var(--t-pale); }
/* Fiche complète d'un sort */
.lien-sort { font-size: inherit; }
.fenetre-sort { width: min(680px, 100%); }
.fenetre-sort .famille-sort { margin: -4px 0 10px; color: var(--encre-douce); font-size: 13px; }
.infos-sort { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.info-sort { display: flex; flex-direction: column; padding: 6px 10px; border-radius: 8px; background: #efe3cc; }
.info-sort small { font-size: 11px; color: var(--encre-douce); text-transform: uppercase; letter-spacing: 0.5px; }
.description-sort { font-style: italic; line-height: 1.5; }
.rubrique-sort h3 { margin: 12px 0 4px; font-size: 15px; font-family: Georgia, serif; }
.rubrique-sort ul { margin: 0; padding-left: 20px; line-height: 1.5; font-size: 14px; }
.info-sort strong { font-weight: 600; font-size: 14px; line-height: 1.35; }

/* ---------- Tapis de jeu et dés en 3D (création du personnage) ---------- */
.tapis-des { position: relative; margin: 10px auto 14px; max-width: 600px; perspective: 900px; perspective-origin: 50% 0%; user-select: none; touch-action: none; cursor: grab; }
.tapis-des.en-main { cursor: grabbing; }
.tapis-des.lance { cursor: progress; }
.tapis-cadre {
  padding: 14px; border-radius: 16px; transform: rotateX(32deg); transform-origin: 50% 100%; transform-style: preserve-3d;
  background: linear-gradient(135deg, #6b3f1f, #4a2a12 40%, #7a4a26 60%, #3d220e);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.45), inset 0 2px 3px rgba(255, 220, 170, 0.25), inset 0 -3px 4px rgba(0, 0, 0, 0.5);
}
.tapis-surface {
  position: relative; height: 230px; border-radius: 9px; transform-style: preserve-3d; overflow: visible;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0.08), transparent 60%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.035) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at center, #2f6b3a, #1d4a26 75%, #163a1d);
  box-shadow: inset 0 0 0 2px #163a1d, inset 0 0 0 5px rgba(232, 204, 140, 0.35), inset 0 0 30px rgba(0, 0, 0, 0.55);
}
/* Le blason au centre du tapis, brodé */
.tapis-surface::before {
  content: "AWEN"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: Georgia, serif; font-size: 44px; letter-spacing: 10px; color: rgba(232, 204, 140, 0.13);
  padding: 10px 22px; border: 2px dashed rgba(232, 204, 140, 0.13); border-radius: 50%; pointer-events: none;
}
.tapis-consigne { text-align: center; margin-top: 10px; font-size: 14px; color: var(--encre-douce); font-style: italic; }
.de-ombre { position: absolute; left: -26px; top: -26px; width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 0, 0, 0.6), transparent 70%); pointer-events: none; }
.de-tenue { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; pointer-events: none; }
.de-corps { position: absolute; transform-style: preserve-3d; }
/* d6 : ivoire, points noirs, coins arrondis */
.de6 { left: -26px; top: -26px; width: 52px; height: 52px; }
.de6 .de-face {
  position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 7px; box-sizing: border-box;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #eadfc6); border-radius: 9px; backface-visibility: hidden;
  box-shadow: inset 0 0 6px rgba(120, 90, 50, 0.45);
}
.de6 .point { margin: 3px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #444, #111); }
/* d4 : tétraèdre rouge sombre, nombres dorés */
.de4 { left: 0; top: 0; width: 0; height: 0; }
.de4-interieur, .de4-pivot { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.de4-face {
  position: absolute; transform-origin: 50% 100%; backface-visibility: hidden;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(170deg, #b8322a, #7a1a14 70%, #5c120e);
}
.de4-base { transform-origin: 50% 50%; background: #5c120e; }
.de4-face .n { position: absolute; font: bold 13px Georgia, serif; color: #f3d27a; text-shadow: 0 1px 1px #000; }
.de4-face .haut { left: 50%; top: 22%; transform: translateX(-50%); font-size: 15px; }
.de4-face .gauche { left: 25%; bottom: 8%; transform: rotate(120deg); }
.de4-face .droite { right: 25%; bottom: 8%; transform: rotate(-120deg); }
.caracs .carac.prochaine { outline: 2px solid var(--t-accent); }
.caracs .a-lancer { color: var(--encre-douce); font-style: italic; }
.de4-face .n { font-size: 14px; }
.de4-face .haut { font-size: 17px; top: 26%; }

/* ---------- Choix des compétences (création) ---------- */
.famille-combat { --fam: #b23b2e; --fam-clair: #f6dcd6; }
.famille-adresse { --fam: #3d8a3a; --fam-clair: #dcefd8; }
.famille-intelligence { --fam: #2f5fae; --fam-clair: #d9e4f6; }
.famille-charisme { --fam: #8a3fa6; --fam-clair: #ecdcf3; }
.famille-aventure { --fam: #a8782a; --fam-clair: #f3e6cc; }
.famille-defaut { --fam: #6f6a63; --fam-clair: #e6e2dc; }
.filtres-competences { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.creation .puce-filtre { padding: 5px 12px; border-radius: 999px; font-size: 13px; border: 2px solid var(--fam, var(--bord)); background: #fff8ec; color: var(--fam, var(--encre)); }
.creation .puce-filtre.actif { background: var(--fam, var(--encre)); color: #fff; }
.grille-competences { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.creation .carte-competence {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; cursor: pointer;
  padding: 10px 12px 10px 14px; border-radius: 10px; border: 1px solid #d8c7a8; border-left: 5px solid var(--fam); background: #fffaf1; color: var(--encre);
  font-family: system-ui, sans-serif; transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
.creation .carte-competence:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12); }
.creation .carte-competence.choisie { background: var(--fam-clair); border-color: var(--fam); box-shadow: 0 0 0 2px var(--fam); }
.carte-competence strong { font-size: 15px; padding-right: 22px; }
.carte-competence .coche { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--fam); color: transparent; font-size: 12px; display: grid; place-items: center; }
.carte-competence.choisie .coche { background: var(--fam); color: #fff; }
.badge-famille { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--fam); color: #fff; }
.resume-competence { font-size: 13px; font-weight: 600; }
.detail-competence { font-size: 12px; color: var(--encre-douce); line-height: 1.4; }
.carte-competence .fiche-source { font-size: 11px; color: var(--encre-douce); font-style: italic; }
.carte-competence.refus { animation: secousse 0.3s; }
@keyframes secousse { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.pied-competences { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.compteur-competences { font-size: 13px; color: var(--encre-douce); }
.grille-competences { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grille-competences { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grille-competences { grid-template-columns: 1fr; } }
.creation .carte-competence.conseillee { background: linear-gradient(180deg, #fff3d6, #fffaf1 60%); border-color: #d9a53a; }
.creation .carte-competence.conseillee.choisie { background: var(--fam-clair); }
.badge-conseil { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #d9a53a; color: #fff; font-weight: 600; }
.raison-conseil { font-size: 11px; color: #9a6a10; font-weight: 600; }
.aide-conseil { font-size: 13px; color: #9a6a10; margin: 0 0 4px; }
.carte-competence .detail-competence { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.creation:has(.grille-competences) { max-width: 1180px; }
.alerte-handicap { font-size: 11px; color: #8f2a1c; font-weight: 600; }

/* Homme-Bête : résultat du D6 de la version */
.bandeau-bete { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; padding: 10px 14px; border: 2px dashed #8a5a2b; border-radius: 10px; background: #fff3dc; color: var(--encre); font-size: 14px; }
.bandeau-bete strong { font-size: 16px; }
