/* ============================================================
   LETHIA V2 — CSS PRINCIPAL
   Charte : fond sombre + or #C9A84C
   Interface : chat style WhatsApp × esthétique Lethia
   ============================================================ */

/* Police pour l'interface de jeu (chat) */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');
/* Polices pour la page d'accueil (écran intro + carousel) */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,400&family=Cormorant+SC:wght@400&family=Jost:wght@200;300&display=swap');


/* ── 1. VARIABLES ─────────────────────────────────────────── */
:root {
  --or:            #C9A84C;
  --or-pale:       rgba(201, 168, 76, 0.14);
  --or-bordure:    rgba(201, 168, 76, 0.22);

  --fond:          #111111;
  --fond-sidebar:  #0d0d0d;
  --fond-entete:   #161616;
  --fond-message:  #1c1c1c;
  --fond-input:    #181818;

  --texte:         #e8dfc8;
  --texte-moyen:   #a89878;
  --texte-pale:    #685e50;

  --rouge:         #d94f4f;

  --rayon:         12px;
  --rayon-bulle:   20px;
  --police:        'EB Garamond', Georgia, serif;

  --barre-h:       60px;
  --sidebar-w:     290px;
}


/* ── 2. RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;         /* Pas de scroll sur body — chaque zone gère le sien */
}

body {
  font-family: var(--police);
  font-size: 19px;           /* Base augmentée — tout le reste scale en rem */
  background: var(--fond);
  color: var(--texte);
}

button   { font-family: var(--police); cursor: pointer; border: none; background: none; }
input,
select   { font-family: var(--police); }
ul       { list-style: none; }
a        { text-decoration: none; color: inherit; }


/* ── 3. BARRE DE STATS ────────────────────────────────────── */
.barre-stats {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--barre-h);
  background: var(--fond-sidebar);
  border-bottom: 1px solid var(--or-bordure);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
}

.stats-gauche {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.btn-retour {
  font-size: 0.82rem;
  background: var(--rouge);
  color: #fff;
  letter-spacing: 0.03em;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 6px;
  transition: background .15s;
}
.btn-retour:hover { background: #c0392b; color: #fff; }

.nom-scenario {
  font-size: 0.88rem;
  color: var(--or);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-centre {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  color: var(--texte-moyen);
}
.stat-sep  { color: var(--or-bordure); }
.stat-item { white-space: nowrap; }

.stats-droite {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Boutons icône (carnet, son) */
.btn-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--or-pale);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 1rem;
  display: grid;
  place-content: center;
  transition: background .15s, color .15s;
}
.btn-icon:hover {
  background: var(--or);
  color: var(--fond);
}


/* ── 4. LAYOUT PRINCIPAL ──────────────────────────────────── */
.layout-chat {
  display: flex;
  height: 100vh;
  padding-top: var(--barre-h);   /* Compense la barre fixe */
}


/* ── 5. SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--fond-sidebar);
  border-right: 1px solid var(--or-bordure);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Zone scrollable des conversations */
.sidebar-conversations {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar-conversations::-webkit-scrollbar { width: 3px; }
.sidebar-conversations::-webkit-scrollbar-thumb {
  background: var(--or-bordure);
  border-radius: 2px;
}

/* Un élément de conversation (groupe ou DM) */
.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.conv-item:hover { background: rgba(201,168,76,.06); }
.conv-item.actif { background: rgba(201,168,76,.11); }
.conv-item.actif .conv-nom { color: var(--or); }

/* Avatar initiales */
.conv-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(201,168,76,.1);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  display: grid;
  place-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}
.avatar-groupe { font-size: 1.1rem; }

/* Texte à droite de l'avatar */
.conv-infos {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conv-nom {
  font-size: 0.88rem;
  color: var(--texte);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.conv-apercu {
  font-size: 0.73rem;
  color: var(--texte-pale);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

/* Badge notification rouge */
.conv-notif {
  background: var(--rouge);
  color: #fff;
  font-size: 0.68rem;
  font-style: normal;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: grid;
  place-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

/* DM encore verrouillé */
.conv-item.verrouille {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}
.conv-verrou {
  font-size: 0.9rem;
  color: var(--texte-pale);
  flex-shrink: 0;
}

/* Séparateur "Conversations privées" */
.sidebar-separateur {
  padding: 14px 14px 5px;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--texte-pale);
}

/* Bouton "Je me souviens" en bas de sidebar */
.btn-souvenir-sidebar {
  margin: 10px 12px 14px;
  padding: 11px 14px;
  border: none;
  border-radius: var(--rayon);
  background: var(--or);
  color: var(--fond);
  font-weight: 300;
  font-size: 0.85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  transition: background .2s;
}
.btn-souvenir-sidebar:hover { background: #e8c86a; }


/* ── 6. ZONE CHAT ─────────────────────────────────────────── */
.zone-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--fond);
}

/* En-tête conversation active */
.entete-chat {
  padding: 10px 16px;
  background: var(--fond-entete);
  border-bottom: 1px solid var(--or-bordure);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.entete-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(201,168,76,.1);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 0.82rem;
  display: grid;
  place-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}
.entete-infos { display: flex; flex-direction: column; gap: 1px; }
.entete-nom    { font-size: 0.92rem; color: var(--texte); }
.entete-statut { font-size: 0.7rem; color: var(--texte-pale); font-style: italic; }

/* Fil de messages */
.zone-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.zone-messages::-webkit-scrollbar { width: 4px; }
.zone-messages::-webkit-scrollbar-thumb {
  background: var(--or-bordure);
  border-radius: 2px;
}


/* ── 7. BULLES DE MESSAGES ────────────────────────────────── */

/* Conteneur d'un message */
.message {
  display: flex;
  gap: 8px;
  max-width: 68%;
  animation: msg-apparu .22s ease;
}
@keyframes msg-apparu {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Personnage — bulle à gauche */
.message-eux { align-self: flex-start; flex-direction: row; }

/* Joueur — bulle à droite */
.message-moi { align-self: flex-end; flex-direction: row-reverse; }

/* Avatar miniature dans les messages */
.message-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(201,168,76,.1);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 0.68rem;
  display: grid;
  place-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  text-transform: uppercase;
}
/* Pas d'avatar pour le joueur */
.message-moi .message-avatar { display: none; }

/* Corps : nom + bulle + heure */
.message-corps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.message-expediteur {
  font-size: 0.7rem;
  color: var(--or);
  letter-spacing: 0.03em;
  padding-left: 3px;
}
.message-moi .message-expediteur { display: none; }

/* La bulle elle-même */
.message-bulle {
  padding: 8px 13px;
  font-size: 0.94rem;
  line-height: 1.55;
  word-break: break-word;
  position: relative;
}

.message-eux .message-bulle {
  background: var(--fond-message);
  border: 1px solid rgba(201,168,76,.1);
  border-radius: var(--rayon-bulle) var(--rayon-bulle) var(--rayon-bulle) 4px;
  color: var(--texte);
}

.message-moi .message-bulle {
  background: var(--or-pale);
  border: 1px solid var(--or-bordure);
  border-radius: var(--rayon-bulle) var(--rayon-bulle) 4px var(--rayon-bulle);
  color: var(--texte);
}

/* Indications scéniques — *texte entre étoiles* */
.didascalie {
  display: block;
  font-style: italic;
  font-size: 0.8em;
  color: var(--texte-pale);
  margin-top: 6px;
}

/* Heure */
.message-heure {
  font-size: 0.62rem;
  color: var(--texte-pale);
  font-style: italic;
  align-self: flex-end;
  padding: 0 3px;
}

/* Bouton épingle — visible au survol (desktop), toujours visible sur mobile */
.btn-epingle {
  font-size: 0.72rem;
  color: var(--texte-pale);
  padding: 4px 6px;
  opacity: 0;
  align-self: center;
  transition: opacity .15s, color .15s;
  flex-shrink: 0;
}
.message-eux:hover .btn-epingle { opacity: 1; }
.btn-epingle:hover { color: var(--or); }

/* Message système (notifications, éphémère, etc.) */
.message-systeme {
  align-self: center;
  font-size: 0.7rem;
  font-style: italic;
  color: var(--texte-pale);
  padding: 4px 12px;
  background: rgba(201,168,76,.05);
  border: 1px solid var(--or-bordure);
  border-radius: 20px;
  margin: 6px 0;
  text-align: center;
  max-width: 80%;
  animation: msg-apparu .22s ease;
}

/* Animation d'effacement éphémère */
@keyframes effacement {
  0%   { opacity: 1; }
  70%  { opacity: 0.35; }
  100% { opacity: 0; max-height: 0; margin: 0; padding: 0; overflow: hidden; }
}
.message-efface {
  animation: effacement 1.8s ease forwards;
  pointer-events: none;
}


/* ── 8. INDICATEUR DE FRAPPE ──────────────────────────────── */
.indicateur-frappe {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 20px 8px;
  flex-shrink: 0;
}

.frappe-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(201,168,76,.1);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 0.65rem;
  display: grid;
  place-content: center;
  text-transform: uppercase;
}

.frappe-bulles {
  display: flex;
  gap: 4px;
  background: var(--fond-message);
  border: 1px solid rgba(201,168,76,.1);
  border-radius: 14px;
  padding: 7px 11px;
}

.frappe-point {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--texte-pale);
  animation: frappe 1.2s ease-in-out infinite;
}
.frappe-point:nth-child(2) { animation-delay: .2s; }
.frappe-point:nth-child(3) { animation-delay: .4s; }

@keyframes frappe {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}


/* ── 9. ZONE DE SAISIE ────────────────────────────────────── */
.zone-saisie {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--fond-entete);
  border-top: 1px solid var(--or-bordure);
  flex-shrink: 0;
}

.input-message {
  flex: 1;
  background: var(--fond-input);
  border: 1px solid var(--or-bordure);
  border-radius: 22px;
  padding: 10px 18px;
  color: var(--texte);
  font-size: 0.92rem;
  outline: none;
  transition: border-color .2s;
}
.input-message:focus        { border-color: var(--or); }
.input-message::placeholder { color: var(--texte-pale); font-style: italic; }

.btn-envoyer {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--or);
  color: var(--fond);
  font-size: 1.2rem;
  display: grid;
  place-content: center;
  flex-shrink: 0;
  transition: opacity .15s, scale .15s;
}
.btn-envoyer:hover { opacity: .85; scale: 1.05; }


/* ── 10. PANNEAU CARNET ───────────────────────────────────── */
/* Slide depuis la droite */
.panneau-carnet {
  position: fixed;
  top: var(--barre-h); right: 0; bottom: 0;
  width: 300px;
  background: var(--fond-sidebar);
  border-left: 1px solid var(--or-bordure);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.4,0,0.2,1);
}
.panneau-carnet.ouvert { transform: translateX(0); }

/* Fond sombre derrière */
.carnet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  display: none;
}
.carnet-overlay.actif { display: block; }

.carnet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--or-bordure);
  flex-shrink: 0;
}
.carnet-titre {
  font-size: 0.95rem;
  color: var(--or);
  letter-spacing: 0.07em;
}
.carnet-fermer {
  color: var(--texte-pale);
  font-size: 0.82rem;
  transition: color .15s;
}
.carnet-fermer:hover { color: var(--or); }

/* Sections internes */
.carnet-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--or-bordure);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.carnet-section:last-child { border-bottom: none; }
.carnet-section::-webkit-scrollbar { width: 3px; }
.carnet-section::-webkit-scrollbar-thumb { background: var(--or-bordure); }

.carnet-epingles { flex: 1.2; }   /* Un peu plus grande que les notes */
.carnet-notes    { flex: 1; }

.carnet-sous-titre {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--texte-pale);
  flex-shrink: 0;
}

/* Listes */
.liste-epingles,
.liste-notes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.item-vide {
  font-size: 0.76rem;
  font-style: italic;
  color: var(--texte-pale);
  line-height: 1.45;
}

/* Un message épinglé */
.item-epingle {
  background: var(--fond-message);
  border: 1px solid rgba(201,168,76,.12);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.epingle-corps {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.item-epingle-source {
  font-size: 0.65rem;
  color: var(--or);
  letter-spacing: 0.03em;
}
.item-epingle-texte {
  font-size: 0.78rem;
  color: var(--texte);
  line-height: 1.45;
}
.btn-suppr-epingle {
  background: none;
  border: none;
  color: var(--texte-pale);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity .15s, color .15s;
}
.btn-suppr-epingle:hover { opacity: 1; color: #c0392b; }

/* Une note libre */
.item-note {
  background: rgba(201,168,76,.05);
  border-left: 2px solid var(--or);
  padding: 6px 8px;
  font-size: 0.78rem;
  color: var(--texte);
  border-radius: 0 6px 6px 0;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
}
.note-texte { flex: 1; }
.note-input-edit {
  flex: 1;
  background: var(--fond-message);
  border: 1px solid var(--or-bordure);
  color: var(--texte);
  font-family: var(--police);
  font-size: inherit;
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
}
.note-input-edit:focus { border-color: var(--or); }
.note-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.btn-note-edit,
.btn-note-suppr {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 0.8rem;
  opacity: 0.45;
  transition: opacity .15s, color .15s;
}
.btn-note-edit  { color: var(--or); }
.btn-note-suppr { color: var(--texte-pale); }
.btn-note-edit:hover  { opacity: 1; }
.btn-note-suppr:hover { opacity: 1; color: #c0392b; }

/* Saisie de note */
.zone-saisie-note {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.input-note {
  flex: 1;
  background: var(--fond-input);
  border: 1px solid var(--or-bordure);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--texte);
  font-size: 0.82rem;
  outline: none;
  transition: border-color .2s;
}
.input-note:focus        { border-color: var(--or); }
.input-note::placeholder { color: var(--texte-pale); font-style: italic; }

.btn-noter {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--or-pale);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 1.1rem;
  display: grid;
  place-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.btn-noter:hover { background: var(--or); color: var(--fond); }


/* ── 11. PANNEAU HYPOTHÈSE ────────────────────────────────── */
.overlay-hypothese {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.68);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.panneau-hypothese {
  background: var(--fond-sidebar);
  border: 1px solid var(--or-bordure);
  border-radius: var(--rayon);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
}
.panneau-hypothese::-webkit-scrollbar { width: 3px; }
.panneau-hypothese::-webkit-scrollbar-thumb { background: var(--or-bordure); }

.hypothese-fermer {
  position: absolute;
  top: 14px; right: 14px;
  color: var(--texte-pale);
  font-size: 0.88rem;
  transition: color .15s;
}
.hypothese-fermer:hover { color: var(--or); }

.hypothese-titre {
  font-size: 1.3rem;
  color: var(--or);
  letter-spacing: 0.05em;
}
.hypothese-sous-titre {
  font-size: 0.82rem;
  color: var(--texte-moyen);
  font-style: italic;
  line-height: 1.55;
  margin-top: -6px;
}

.groupe-hypothese { display: flex; flex-direction: column; gap: 6px; }

.label-select    { font-size: 0.8rem; color: var(--texte-moyen); }
.label-optionnel { font-size: 0.7rem; color: var(--texte-pale); font-style: italic; }

.select-hypothese,
.input-nom {
  width: 100%;
  background: var(--fond-input);
  border: 1px solid var(--or-bordure);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--texte);
  font-size: 0.88rem;
  outline: none;
  transition: border-color .2s;
  appearance: none;
}
.select-hypothese:focus,
.input-nom:focus       { border-color: var(--or); }
.select-hypothese option { background: var(--fond-sidebar); color: var(--texte); }

.erreur-hypothese {
  font-size: 0.78rem;
  color: var(--rouge);
  font-style: italic;
}

.actions-hypothese {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.btn-valider {
  flex: 1;
  padding: 11px 16px;
  background: var(--or);
  color: var(--fond);
  border-radius: 8px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  transition: opacity .15s;
}
.btn-valider:hover { opacity: .85; }

.btn-annuler {
  padding: 11px 16px;
  border: 1px solid var(--or-bordure);
  border-radius: 8px;
  color: var(--texte-moyen);
  font-size: 0.88rem;
  transition: border-color .15s, color .15s;
}
.btn-annuler:hover { border-color: var(--or); color: var(--or); }


/* ── 12. RESPONSIVE MOBILE — PAGE JEU ────────────────────── */

/* Bouton menu : masqué sur desktop */
.btn-menu {
  display: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--or-pale);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 768px) {

  /* ── Bouton menu ☰ ──────────────────────────────────────── */
  .btn-menu { display: flex; }

  /* ── Header : timer seul, échanges/tentatives masqués ───── */
  .nom-scenario { display: none; }
  .stat-extra   { display: none; }
  .stat-chrono  { font-size: 1.2rem; font-weight: 600; letter-spacing: 0.05em; }

  /* Quitter le jeu → déplacé dans le panneau ⚙ sur mobile */
  .btn-retour { display: none; }

  /* Musique masquée du header → disponible dans le panneau ⚙ */
  #btn-son { display: none; }

  /* Épingle toujours visible sur mobile (pas de survol) */
  .btn-epingle { opacity: 0.5; }

  /* ── Sidebar : drawer gauche ─────────────────────────────── */
  .sidebar {
    position: fixed;
    top: var(--barre-h); left: 0; bottom: 0;
    z-index: 150;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .sidebar.ouverte { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 149;
  }
  .sidebar-overlay.actif { display: block; }

  /* ── Zone chat ───────────────────────────────────────────── */
  .zone-chat { width: 100%; }
  .message   { max-width: 88%; }

  /* ── Carnet : pleine largeur ─────────────────────────────── */
  .panneau-carnet { width: 100%; }

  /* ── Tailles de texte mobile (base 1rem, proportions × 5/6) */
  .stats-centre          { font-size: 1rem; }
  .btn-retour            { font-size: 1rem; }
  .nom-scenario          { font-size: 1rem; }

  .message-bulle         { font-size: 1.1rem; }
  .message-expediteur    { font-size: 1.1rem; }
  .message-heure         { font-size: 1rem; }
  .message-systeme       { font-size: 1rem; }

  .conv-nom              { font-size: 1.15rem; }
  .conv-apercu           { font-size: 1rem; }
  .conv-verrou           { font-size: 1rem; }
  .sidebar-separateur    { font-size: 1rem; }
  .btn-souvenir-sidebar  { font-size: 1.1rem; }

  .entete-nom            { font-size: 1.3rem; }
  .entete-statut         { font-size: 1rem; }

  .input-message         { font-size: 1.1rem; padding: 12px 16px; }
  .input-note            { font-size: 1.1rem; }

  .carnet-titre          { font-size: 1.2rem; }
  .carnet-sous-titre     { font-size: 1rem; }
  .item-epingle-texte    { font-size: 1rem; }
  .item-note             { font-size: 1rem; }
  .item-vide             { font-size: 1rem; }
  .item-epingle-source   { font-size: 1rem; }

  .hypothese-titre       { font-size: 1.65rem; }
  .hypothese-sous-titre  { font-size: 1rem; }
  .label-select          { font-size: 1rem; }
  .label-optionnel       { font-size: 1rem; }
  .select-hypothese,
  .input-nom             { font-size: 1.1rem; }
  .erreur-hypothese      { font-size: 1rem; }
  .btn-valider,
  .btn-annuler           { font-size: 1rem; }

  /* Panneau paramètres : pleine largeur sur mobile */
  .panneau-parametres { width: 100%; }
}

/* ── Tailles de texte desktop — minimum 1.2rem, proportions × 4/3 ── */
@media (min-width: 769px) {

/* Barre de stats */
.stats-centre  { font-size: 1.25rem; }
.btn-retour    { font-size: 1.2rem; }
.nom-scenario  { font-size: 1.2rem; }

/* Messages */
.message-bulle       { font-size: 1.6rem; }
.message-expediteur  { font-size: 1.35rem; }
.message-heure       { font-size: 1.2rem; }
.message-systeme     { font-size: 1.2rem; }
.btn-epingle         { font-size: 1.2rem; }

/* Sidebar */
.sidebar-separateur   { font-size: 1.2rem; }
.conv-nom             { font-size: 1.4rem; }
.conv-apercu          { font-size: 1.25rem; }
.conv-verrou          { font-size: 1.2rem; }
.conv-notif           { font-size: 1.2rem; }
.btn-souvenir-sidebar { font-size: 1.35rem; }

/* En-tête chat */
.entete-nom    { font-size: 1.55rem; }
.entete-statut { font-size: 1.25rem; }

/* Inputs */
.input-message { font-size: 1.35rem; }
.input-note    { font-size: 1.35rem; }

/* Carnet */
.carnet-titre          { font-size: 1.45rem; }
.carnet-sous-titre     { font-size: 1.2rem; }
.carnet-fermer         { font-size: 1.2rem; }
.item-epingle-source   { font-size: 1.2rem; }
.item-epingle-texte    { font-size: 1.2rem; }
.item-note             { font-size: 1.2rem; }
.item-vide             { font-size: 1.2rem; }

/* Hypothèse */
.hypothese-titre      { font-size: 2rem; }
.hypothese-sous-titre { font-size: 1.25rem; }
.hypothese-fermer     { font-size: 1.2rem; }
.label-select         { font-size: 1.25rem; }
.label-optionnel      { font-size: 1.2rem; }
.select-hypothese,
.input-nom            { font-size: 1.35rem; }
.erreur-hypothese     { font-size: 1.2rem; }
.btn-valider,
.btn-annuler          { font-size: 1.2rem; }

}


/* ── 13. PANNEAU PARAMÈTRES ──────────────────────────────── */
.btn-engrenage {
  /* Visible sur desktop aussi — utile pour accéder aux stats/musique */
}

.panneau-parametres {
  position: fixed;
  top: var(--barre-h); right: 0; bottom: 0;
  width: 260px;
  background: var(--fond-sidebar);
  border-left: 1px solid var(--or-bordure);
  z-index: 200;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}
.panneau-parametres.ouvert { transform: translateX(0); }

.params-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--or-bordure);
}
.params-titre {
  font-size: 1.1rem;
  color: var(--or);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}
.params-fermer {
  background: none;
  border: none;
  color: var(--texte-pale);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  transition: color .15s;
}
.params-fermer:hover { color: var(--or); }

.params-corps {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 0;
  overflow-y: auto;
  flex: 1;
}

.params-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}
.params-label {
  font-size: 1rem;
  color: var(--texte-moyen);
}
.params-valeur {
  font-size: 1.3rem;
  color: var(--or);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.params-separateur {
  height: 1px;
  background: var(--or-bordure);
  margin: 8px 20px;
}

.btn-son-panel {
  background: var(--or-pale);
  border: 1px solid var(--or-bordure);
  color: var(--or);
  font-size: 1rem;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
  font-family: var(--police);
}
.btn-son-panel:hover { background: rgba(201,168,76,.18); }

.btn-quitter-panel {
  display: block;
  margin: 0 12px 12px;
  padding: 12px 20px;
  background: #8b2e2e;
  color: #fff;
  font-size: 1rem;
  letter-spacing: 0.03em;
  border-radius: 8px;
  text-align: center;
  transition: background .15s;
}
.btn-quitter-panel:hover { background: #6e2020; }

.params-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
}
.params-overlay.actif { display: block; }


/* ── 14. POPUP ÉCHEC HYPOTHÈSE ───────────────────────────── */
.overlay-echec {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 310;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.panneau-echec {
  background: var(--fond-sidebar);
  border: 1px solid var(--or-bordure);
  border-radius: var(--rayon);
  padding: 28px 28px 24px;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.echec-titre {
  font-size: 1.5rem;
  color: var(--or);
  letter-spacing: 0.05em;
  margin: 0;
}
.echec-sous-titre {
  font-size: 1rem;
  color: var(--texte-moyen);
  margin: -10px 0 0;
}
.echec-liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.echec-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--fond-message);
}
.echec-ok { border-left: 3px solid #5cb85c; }
.echec-ko { border-left: 3px solid var(--rouge); }
.echec-icone {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.echec-ok .echec-icone { color: #5cb85c; }
.echec-ko .echec-icone { color: var(--rouge); }
.echec-label {
  font-size: 0.85rem;
  color: var(--texte-moyen);
  width: 58px;
  flex-shrink: 0;
}
.echec-valeur {
  font-size: 0.95rem;
  color: var(--texte);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-reprendre {
  background: var(--or);
  color: var(--fond);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: var(--police);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  align-self: center;
  transition: background .15s;
}
.btn-reprendre:hover { background: #e8c86a; }


/* ── 15. PAGE D'ACCUEIL ───────────────────────────────────── */

/* Variables spécifiques à l'accueil (palette plus chaude) */
.page-accueil {
  --fond-principal:   #0F0C07;
  --fond-secondaire:  #1A1208;
  --couleur-or:       #C9A84C;
  --couleur-or-pale:  #E8D5A3;
  --texte-principal:  #F5ECD7;
  --texte-secondaire: #B8A882;
  --bordure:          1px solid rgba(201, 168, 76, 0.20);
  --font-titre:       'Cormorant Garamond', serif;
  --font-sc:          'Cormorant SC', serif;
  --font-corps:       'Jost', sans-serif;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--fond-principal);
  color: var(--texte-principal);
  font-family: var(--font-corps);
  font-weight: 300;
  overflow: auto;      /* L'accueil scrolle normalement (pas comme le chat) */
}

/* ── Écran intro ── */
.ecran-intro {
  position: fixed;
  inset: 0;
  background: var(--fond-principal);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 40px 24px;
}

.intro-contenu {
  max-width: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.intro-logo { display: block; margin: 0 auto; opacity: 0.85; }

.intro-titre {
  font-family: var(--font-sc);
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  letter-spacing: 16px;
  color: var(--texte-principal);
  position: relative;
  display: inline-block;
}

/* Tranches colorées pour l'effet glitch sur le titre */
.intro-titre::before,
.intro-titre::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
}

.intro-separateur {
  width: 48px; height: 1px;
  background: var(--couleur-or);
  opacity: 0.35;
}

.intro-accroche {
  font-family: var(--font-titre);
  font-style: italic;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: var(--texte-principal);
  line-height: 1.7;
  letter-spacing: 1px;
}

.intro-description {
  font-weight: 200;
  font-size: 1.1rem;
  color: var(--texte-secondaire);
  line-height: 1.9;
}

.btn-souvenir {
  background: transparent;
  border: 1px solid var(--couleur-or);
  color: var(--couleur-or);
  font-family: var(--font-corps);
  font-weight: 200;
  font-size: 1rem;
  letter-spacing: 6px;
  text-transform: uppercase;
  padding: 10px 32px;
  cursor: pointer;
  margin-top: 8px;
  transition: background .3s ease, color .3s ease;
}
.btn-souvenir:hover {
  background: var(--couleur-or);
  color: var(--fond-principal);
}

/* ── Animation glitch ── */
.ecran-intro.glitch-actif {
  animation: glitch-ecran 0.85s steps(4) forwards;
}
@keyframes glitch-ecran {
  0%   { transform: none;         filter: none; }
  12%  { transform: skewX(-5deg); filter: brightness(2); }
  25%  { transform: skewX(5deg);  filter: brightness(0.3) hue-rotate(180deg); }
  40%  { transform: skewX(-3deg); filter: brightness(2.5); }
  55%  { transform: skewX(3deg);  filter: brightness(0.1); }
  70%  { transform: skewX(-1deg); filter: brightness(3) hue-rotate(90deg); }
  85%  { transform: none;         filter: brightness(4); }
  100% { transform: none;         filter: none; opacity: 0; }
}
.ecran-intro.glitch-actif .intro-titre::before {
  opacity: 1; color: #ff003c;
  animation: glitch-tranche-1 0.85s steps(4) forwards;
}
.ecran-intro.glitch-actif .intro-titre::after {
  opacity: 1; color: #00d4ff;
  animation: glitch-tranche-2 0.85s steps(4) forwards;
}
@keyframes glitch-tranche-1 {
  0%   { clip-path: inset(30% 0 58% 0); transform: translate(-10px); }
  20%  { clip-path: inset(80% 0 5%  0); transform: translate(10px); }
  40%  { clip-path: inset(10% 0 75% 0); transform: translate(-10px); }
  60%  { clip-path: inset(55% 0 30% 0); transform: translate(10px); }
  80%  { clip-path: inset(5%  0 88% 0); transform: translate(-5px); }
  100% { clip-path: inset(0   0 100% 0); transform: translate(0); }
}
@keyframes glitch-tranche-2 {
  0%   { clip-path: inset(60% 0 20% 0); transform: translate(10px); }
  20%  { clip-path: inset(15% 0 65% 0); transform: translate(-10px); }
  40%  { clip-path: inset(45% 0 40% 0); transform: translate(10px); }
  60%  { clip-path: inset(25% 0 60% 0); transform: translate(-10px); }
  80%  { clip-path: inset(70% 0 15% 0); transform: translate(5px); }
  100% { clip-path: inset(0   0 100% 0); transform: translate(0); }
}

/* ── Contenu principal révélé après glitch ── */
.contenu-principal {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── En-tête accueil ── */
.header-accueil {
  text-align: center;
  padding: 18px 20px 12px;
  border-bottom: var(--bordure);
}
.logo-svg      { display: block; margin: 0 auto 8px; }
.logo-lethia {
  font-family: var(--font-sc);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  letter-spacing: 8px;
  color: var(--texte-principal);
  margin-bottom: 4px;
}
.slogan {
  font-weight: 200;
  font-size: 0.9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--texte-secondaire);
}

/* ── Contenu accueil ── */
.contenu-accueil {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 40px;
  width: 100%;
}
.titre-section {
  font-family: var(--font-sc);
  font-size: 1.1rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--texte-secondaire);
  font-weight: 400;
  margin-bottom: 16px;
}

/* ── Carousel ── */
.carousel {
  --nav-btn-size: 36px;
  anchor-name: --carousel;
  width: 100%;
  padding-block: 1.5rem 3rem;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 400px;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;

  &::before, &::after {
    content: '';
    width: calc(50% - 200px);
  }

  scroll-marker-group: after;
  &::scroll-marker-group {
    position: absolute;
    position-anchor: --carousel;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding-block-start: 0.75rem;
    top: anchor(bottom);
    left: anchor(left);
    right: anchor(right);
  }

  > .carte-scenario {
    padding-inline: 12px;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    container-type: scroll-state;

    &.scroll-start { scroll-initial-target: nearest; }

    .carte-inner {
      height: 100%;
      transition: scale .38s cubic-bezier(0.4,0,0.2,1), opacity .38s ease, filter .38s ease;
      transform-origin: top center;
    }

    @container not scroll-state(snapped: inline) {
      .carte-inner { scale: 0.82; opacity: 0.55; filter: blur(2px); }
    }

    &::scroll-marker {
      content: ' ';
      height: 6px;
      aspect-ratio: 1;
      background: var(--couleur-or);
      border-radius: 50%;
      transition: 150ms ease-in-out;
      scale: 0.75;
      opacity: 0.25;
    }
    &::scroll-marker:target-current { opacity: 1; scale: 1; }
    &::scroll-marker:where(:hover, :focus-visible) { opacity: 0.7; }
  }

}

/* ── Carte de scénario ── */
.carte-scenario { min-height: 360px; }

.carte-inner {
  background: var(--fond-secondaire);
  border: var(--bordure);
  padding: 36px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  height: 100%;
}
.carte-scenario.disponible .carte-inner {
  border-color: rgba(201, 168, 76, 0.35);
}

.badge-scenario {
  position: absolute;
  top: -1px; right: 28px;
  background: var(--couleur-or);
  color: var(--fond-principal);
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 2px 8px;
}

.infos-scenario   { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.titre-scenario   { font-family: var(--font-titre); font-size: 1.3rem; font-weight: 300; line-height: 1.3; }
.lieu-scenario    { font-weight: 200; font-size: 0.85rem; letter-spacing: 3px; text-transform: uppercase; color: var(--couleur-or); }
.description-scenario { font-size: 1rem; color: var(--texte-secondaire); line-height: 1.6; }

.details-scenario {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--texte-secondaire);
  font-weight: 200;
  border-top: var(--bordure);
  padding-top: 12px;
}

.btn-jouer {
  display: block;
  background: var(--couleur-or);
  color: var(--fond-principal);
  font-weight: 300;
  font-size: 0.9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  padding: 10px 16px;
  transition: background .2s ease;
  margin-top: auto;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn-jouer:hover        { background: var(--couleur-or-pale); color: var(--fond-principal); }
.btn-jouer.desactive    { background: rgba(201,168,76,.15); color: var(--texte-secondaire); cursor: not-allowed; }

/* ── Wrapper + boutons latéraux du carousel ── */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.carousel-side-btn {
  position: absolute;
  z-index: 10;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--couleur-or);
  color: var(--fond-principal);
  border: none;
  font-size: 1rem;
  display: grid;
  place-content: center;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity .15s, scale .15s;
  top: 50%;
  transform: translateY(-50%);
}
.carousel-side-prev { left: 8px; }
.carousel-side-next { right: 8px; }
.carousel-side-btn:hover:not(:disabled) { opacity: 1; scale: 1.1; }
.carousel-side-btn:disabled             { opacity: 0.2; cursor: default; }

/* ── Responsive mobile ── */
@media (max-width: 600px) {

  .contenu-accueil {
    padding: 16px 0;          /* Supprime le padding latéral qui rétrécissait les cartes */
  }

  .titre-section {
    padding: 0 16px;
    font-size: 0.85rem;
  }

  /* Carousel : une carte = pleine largeur écran */
  .carousel {
    grid-auto-columns: calc(100vw - 32px);
    padding-block: 1rem 1.5rem;

    /* Pas de pseudo-éléments de centrage sur mobile */
    &::before, &::after { display: none; }
  }

  /* Flèches latérales : plus petites sur mobile, bien sur les côtés */
  .carousel-side-btn {
    width: 32px; height: 32px;
    font-size: 0.85rem;
  }
  .carousel-side-prev { left: 4px; }
  .carousel-side-next { right: 4px; }

  /* Cartes : padding latéral réduit pour laisser de la place aux flèches */
  .carte-scenario { padding-inline: 40px; }

}

/* ── Pied de page ── */
.footer-lethia {
  text-align: center;
  padding: 24px;
  border-top: var(--bordure);
  font-size: 0.85rem;
  font-weight: 200;
  letter-spacing: 2px;
  color: var(--texte-secondaire);
}


/* ── 13. ÉCRAN DE FIN ─────────────────────────────────────── */
.zone-fin {
  position: fixed;
  inset: 0;
  background: var(--fond);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  flex-direction: column;
  gap: 20px;
}
