/* ═══════════════════════════════════════════════════════
   NUIT MORTE — Feuille de style
   Thème : horreur atmosphérique, post-apocalyptique
   Palette : noir charbon, rouge sang, kaki rouillé
═══════════════════════════════════════════════════════ */

/* ─── Variables globales ─── */
:root {
  --noir:       #080808;
  --noir-2:     #111111;
  --noir-3:     #1a1a1a;
  --rouge:      #8b0000;
  --rouge-vif:  #c0392b;
  --rouge-pale: #3d0000;
  --kaki:       #4a3728;
  --texte:      #c9b99a;
  --texte-dim:  #6b5a48;
  --blanc:      #e8dcc8;
  --or:         #8a6a3a;

  /* Délai de transition entre scènes (secondes)
     ➜ Change cette valeur pour ajuster le timing global par défaut
     ➜ Chaque scène peut aussi définir son propre délai */
  --transition-delay: 2s;
}

/* ─── Reset & base ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--noir);
  color: var(--texte);
  font-family: 'Crimson Text', serif;
  font-size: 18px;
  cursor: default;
}

/* ─── Utilitaires ─── */
.hidden { display: none !important; }

/* Animation de fondu entrant */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Animation de fondu sortant */
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Texte qui apparaît ligne par ligne */
@keyframes textReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Pulsation lente pour les éléments actifs */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Tremblements (horreur) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-4px) rotate(-0.5deg); }
  40%       { transform: translateX(4px) rotate(0.5deg); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}

/* Points de chargement */
@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0);   opacity: 0.3; }
  40%            { transform: translateY(-8px); opacity: 1; }
}


/* ═══════════════════════════════════════════════════════
   ÉCRAN DE TITRE
═══════════════════════════════════════════════════════ */
#title-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
          radial-gradient(ellipse at center, #1a0000 0%, var(--noir) 70%);
  z-index: 100;
  animation: fadeIn 2s ease forwards;
}

/* Grain statique sur le titre */
#title-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
}

#title-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  position: relative;
  z-index: 1;
}

#title-sub {
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--texte-dim);
  animation: fadeIn 1.5s ease forwards 0.5s;
  opacity: 0;
}

#title-name {
  font-family: 'Cinzel', serif;
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--blanc);
  text-shadow:
          0 0 60px rgba(139, 0, 0, 0.8),
          0 0 120px rgba(139, 0, 0, 0.3);
  animation: fadeIn 1.5s ease forwards 0.8s;
  opacity: 0;
  line-height: 1.1;
}

/* Bouton d'action générique (titre + fin) */
.btn-action {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--texte);
  background: transparent;
  border: 1px solid var(--or);
  padding: 0.9rem 2.8rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color 0.3s, border-color 0.3s;
  animation: fadeIn 1.5s ease forwards 1.4s;
  opacity: 0;
}

.btn-action::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--rouge);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
  z-index: -1;
}

.btn-action:hover { color: var(--blanc); border-color: var(--rouge-vif); }
.btn-action:hover::before { transform: scaleX(1); }


/* ═══════════════════════════════════════════════════════
   ÉCRAN DE JEU
═══════════════════════════════════════════════════════ */
#game-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  animation: fadeIn 1s ease;
}

/* Image de fond de scène */
#scene-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* Couleur par défaut si pas d'image */
  background-color: #0d0806;
  transition: background-image 0.8s ease, background-color 0.8s ease;
  z-index: 0;
}

/* Grain animé par-dessus tout */
#overlay-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px;
  animation: grainAnim 0.15s steps(1) infinite;
}

@keyframes grainAnim {
  0%   { background-position: 0 0; }
  25%  { background-position: 30% 60%; }
  50%  { background-position: 70% 20%; }
  75%  { background-position: 40% 80%; }
  100% { background-position: 0 0; }
}

/* Vignette (assombrit les bords) */
#overlay-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
          ellipse at center,
          transparent 30%,
          rgba(0, 0, 0, 0.75) 100%
  );
}


/* ─── Barre du haut ─── */
#top-bar {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 1.2rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(138, 106, 58, 0.15);
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
}

#top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Bouton retour en arrière */
#back-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(138, 106, 58, 0.3);
  color: var(--texte);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.25s, border-color 0.25s;
  font-family: 'Cinzel', serif;
}

#back-btn:hover:not(:disabled) {
  background: rgba(138, 106, 58, 0.2);
  border-color: var(--or);
}

#back-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#back-count {
  font-size: 0.7rem;
  color: var(--or);
}

/* Bouton home */
#home-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(138, 106, 58, 0.3);
  color: var(--texte);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.25s, border-color 0.25s;
}

#home-btn:hover {
  background: rgba(139, 0, 0, 0.2);
  border-color: var(--rouge);
}

#scene-title {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--texte-dim);
}

/* Bouton inventaire */
#inventory-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(138, 106, 58, 0.3);
  color: var(--texte);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.25s, border-color 0.25s;
  font-family: 'Cinzel', serif;
}

#inventory-btn:hover {
  background: rgba(139, 0, 0, 0.2);
  border-color: var(--rouge);
}

#inv-count {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--texte-dim);
}

/* Bouton sauvegarde 💾 */
#save-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(138, 106, 58, 0.3);
  color: var(--texte);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.25s, border-color 0.25s;
}
#save-btn:hover {
  background: rgba(138, 106, 58, 0.2);
  border-color: var(--or);
}


/* ─── Zone narrative centrale ─── */
#narrative-box {
  position: relative;
  z-index: 10;
  width: min(680px, 90vw);
  background: rgba(8, 8, 8, 0.82);
  border: 1px solid rgba(138, 106, 58, 0.2);
  border-top: 2px solid var(--rouge);
  padding: 2.4rem 2.8rem;
  backdrop-filter: blur(6px);
  box-shadow:
          0 0 60px rgba(0,0,0,0.8),
          inset 0 0 30px rgba(0,0,0,0.4);
}

#narrative-text {
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--texte);
  min-height: 80px;
  animation: textReveal 0.6s ease forwards;
}

/* Points d'attente (pendant le délai) */
#loading-dots {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

#loading-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--rouge-vif);
  animation: dotBounce 1.2s ease-in-out infinite;
}
#loading-dots span:nth-child(2) { animation-delay: 0.2s; }
#loading-dots span:nth-child(3) { animation-delay: 0.4s; }


/* ─── Zone des choix ─── */
#choices-area {
  position: relative;
  z-index: 10;
  width: min(680px, 90vw);
  padding: 0 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Bouton de choix individuel */
.choice-btn {
  width: 100%;
  background: rgba(10, 8, 8, 0.8);
  border: 1px solid rgba(138, 106, 58, 0.25);
  border-left: 3px solid var(--kaki);
  color: var(--texte);
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  text-align: left;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  backdrop-filter: blur(4px);
}

.choice-btn::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: rgba(139, 0, 0, 0.18);
  transition: width 0.35s ease;
}

.choice-btn:hover {
  border-color: var(--rouge);
  border-left-color: var(--rouge-vif);
  color: var(--blanc);
}

.choice-btn:hover::before { width: 100%; }

/* Numéro de choix (décoratif) */
.choice-btn .choice-num {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--texte-dim);
  margin-right: 0.8rem;
}

/* Bouton désactivé (ex: arme non portée) */
.choice-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-left-color: var(--texte-dim);
}

.choice-btn:disabled::before { display: none; }

/* Bouton verrouillé (condition non remplie, visible mais grisé) */
.choice-btn.locked {
  opacity: 0.25;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* Bouton désactivé pendant le délai de transition */
.choice-btn.transitioning {
  pointer-events: none;
  opacity: 0.4;
}


/* ═══════════════════════════════════════════════════════
   PANNEAU INVENTAIRE
═══════════════════════════════════════════════════════ */
#inventory-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

#inventory-inner {
  width: min(560px, 92vw);
  background: var(--noir-2);
  border: 1px solid rgba(138, 106, 58, 0.3);
  border-top: 2px solid var(--or);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  box-shadow: 0 20px 80px rgba(0,0,0,0.9);
  animation: fadeIn 0.25s ease, textReveal 0.3s ease;
}

#inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(138, 106, 58, 0.2);
  padding-bottom: 1rem;
}

#inventory-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--or);
}

#close-inv-btn {
  background: none;
  border: 1px solid rgba(138, 106, 58, 0.3);
  color: var(--texte-dim);
  font-size: 1rem;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}

#close-inv-btn:hover { border-color: var(--rouge); color: var(--rouge-vif); }

/* Grille des objets */
#inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  min-height: 80px;
}

/* Case d'inventaire individuelle */
.inv-slot {
  background: var(--noir-3);
  border: 1px solid rgba(138, 106, 58, 0.15);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem;
  /* Non cliquable : pointer-events géré en JS */
  cursor: default;
}

.inv-slot .slot-icon  { font-size: 1.8rem; }
.inv-slot .slot-label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-align: center;
  color: var(--texte-dim);
  text-transform: uppercase;
  line-height: 1.2;
}

/* Case vide (slot libre) */
.inv-slot.empty {
  border-style: dashed;
  opacity: 0.25;
}

/* Zone d'état des lieux */
#inventory-status {
  border-top: 1px solid rgba(138, 106, 58, 0.15);
  padding-top: 1.2rem;
}

#status-text {
  font-size: 0.92rem;
  font-style: italic;
  color: var(--texte-dim);
  line-height: 1.7;
}


/* ═══════════════════════════════════════════════════════
   ÉCRAN DE FIN
═══════════════════════════════════════════════════════ */
#end-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--noir);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 1.5s ease;
}

#end-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  max-width: 500px;
  padding: 2rem;
}

#end-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--rouge-vif);
  text-shadow: 0 0 40px rgba(192, 57, 43, 0.6);
  letter-spacing: 0.1em;
}

#end-message {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--texte-dim);
  line-height: 1.8;
}


/* ═══════════════════════════════════════════════════════
   EFFETS SPÉCIAUX (déclenchés par JS)
═══════════════════════════════════════════════════════ */

/* Flash rouge (jumpscares) */
.flash-red {
  animation: flashRed 0.4s ease forwards;
}

@keyframes flashRed {
  0%   { background-color: transparent; }
  30%  { background-color: rgba(139, 0, 0, 0.35); }
  100% { background-color: transparent; }
}

/* Écran qui tremble */
.screen-shake {
  animation: shake 0.5s ease;
}

/* Texte rouge pour les moments critiques */
.text-danger { color: var(--rouge-vif); }

/* Mise en valeur d'un objet important dans le texte */
.text-item {
  color: var(--or);
  font-style: italic;
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Mobile first
═══════════════════════════════════════════════════════ */

/* ─── Conteneurs principaux scrollables sur petits écrans ─── */
html, body {
  /* déjà overflow:hidden sur desktop — on surcharge en mobile */
}

@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100%;
  }

  #game-screen {
    position: relative;
    min-height: 100dvh;
    overflow-y: auto;
    justify-content: flex-start;
    padding-bottom: 1rem;
  }

  #scene-bg,
  #overlay-grain,
  #overlay-vignette {
    position: fixed;
    /* reste en fond fixe même si le contenu scroll */
  }

  #top-bar {
    position: sticky;
    top: 0;
    padding: 0.8rem 1rem;
    flex-wrap: wrap;
    gap: 0.4rem;
    z-index: 20;
  }

  #scene-title {
    font-size: 0.62rem;
    letter-spacing: 0.15em;
    flex: 1 1 100%;
    order: -1;
  }

  #top-bar-right {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  #back-btn,
  #home-btn,
  #admin-btn,
  #save-btn,
  #inventory-btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
  }

  #narrative-box {
    width: 100%;
    margin: 0.6rem 0;
    padding: 1.4rem 1.2rem;
    border-left: none;
    border-right: none;
  }

  #narrative-text {
    font-size: 1rem;
    line-height: 1.75;
  }

  #choices-area {
    width: 100%;
    padding: 0 0 2rem;
  }

  .choice-btn {
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
  }

  #inventory-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  #inventory-inner {
    width: 95vw;
    max-height: 90dvh;
    overflow-y: auto;
  }
}

@media (max-width: 400px) {
  #title-name { font-size: clamp(2.4rem, 13vw, 5rem); }
  #narrative-text { font-size: 0.95rem; }
  #inventory-grid { grid-template-columns: repeat(2, 1fr); }
  #top-bar-right { gap: 0.25rem; }
}


/* ═══════════════════════════════════════════════════════
   PANNEAU DE SAUVEGARDE
═══════════════════════════════════════════════════════ */
#save-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

#save-modal {
  width: min(520px, 94vw);
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--noir-2);
  border: 1px solid rgba(138, 106, 58, 0.35);
  border-top: 2px solid var(--or);
  padding: 1.8rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  box-shadow: 0 20px 80px rgba(0,0,0,0.9);
  animation: textReveal 0.3s ease;
}

#save-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(138, 106, 58, 0.2);
  padding-bottom: 0.9rem;
}

#save-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--or);
}

#save-close-btn {
  background: none;
  border: 1px solid rgba(138, 106, 58, 0.3);
  color: var(--texte-dim);
  font-size: 1rem;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
#save-close-btn:hover { border-color: var(--rouge); color: var(--rouge-vif); }

/* Onglets */
#save-tabs {
  display: flex;
  gap: 0;
  border: 1px solid rgba(138, 106, 58, 0.25);
}

.save-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(138, 106, 58, 0.25);
  color: var(--texte-dim);
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.65rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.save-tab:last-child { border-right: none; }
.save-tab:hover      { background: rgba(138,106,58,0.08); color: var(--texte); }
.save-tab.active     { background: rgba(138,106,58,0.15); color: var(--or); }

/* Contenu onglet */
.save-tab-content { display: flex; flex-direction: column; gap: 0.9rem; }

.save-hint {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--texte-dim);
  line-height: 1.5;
}

/* Ligne de saisie */
#save-input-row {
  display: flex;
  gap: 0.6rem;
}

#save-name-input {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #333;
  color: var(--texte);
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
#save-name-input:focus { border-color: var(--or); }

#save-confirm-btn {
  background: var(--rouge);
  border: none;
  color: var(--blanc);
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
#save-confirm-btn:hover { background: var(--rouge-vif); }

/* Feedback */
#save-feedback {
  font-size: 0.82rem;
  min-height: 1.2em;
  line-height: 1.5;
}
.save-feedback-ok    { color: #7fff7f; }
.save-feedback-error { color: var(--rouge-vif); }

/* Label "Saves existantes" */
#save-existing-label {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--texte-dim);
  border-top: 1px solid rgba(138,106,58,0.15);
  padding-top: 0.8rem;
}

/* Rangées de saves */
.save-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  background: var(--noir-3);
  border: 1px solid rgba(138,106,58,0.12);
  transition: border-color 0.2s;
}
.save-row:hover { border-color: rgba(138,106,58,0.3); }

.save-row-name {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--blanc);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-row-date {
  font-size: 0.7rem;
  color: var(--texte-dim);
  white-space: nowrap;
}

.save-row-scene {
  font-size: 0.68rem;
  font-family: monospace;
  color: var(--or);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Bouton supprimer */
.save-delete-btn {
  background: transparent;
  border: 1px solid rgba(139,0,0,0.3);
  color: var(--rouge-vif);
  font-size: 0.85rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.save-delete-btn:hover { opacity: 1; border-color: var(--rouge-vif); }

/* Rangée de chargement (onglet "Charger") */
.load-row {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.save-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
}

.save-row-info .save-row-date {
  font-size: 0.68rem;
}

.load-confirm-btn {
  background: rgba(138,106,58,0.18);
  border: 1px solid var(--or);
  color: var(--or);
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.load-confirm-btn:hover {
  background: rgba(138,106,58,0.35);
  color: var(--blanc);
}

@media (max-width: 480px) {
  #save-modal { padding: 1.2rem 1rem; }
  #save-input-row { flex-direction: column; }
  .save-row-scene { display: none; }
}



.dice-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
}

.dice-overlay img {
  width: 200px;
  margin-bottom: 20px;
}



/* ═══════════════════════════════════════════════════════════════════
   DELTA CSS — Colle ce bloc À LA FIN de style.css
   Styles de la fenêtre de jet de dés (des.js)
═══════════════════════════════════════════════════════════════════ */

/* Fond assombri derrière la fenêtre */
#dice-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

/* Boîte principale */
#dice-modal {
  background: var(--noir-2);
  border: 1px solid rgba(138, 106, 58, 0.35);
  border-top: 2px solid var(--or);
  padding: 2.5rem 3rem;
  text-align: center;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.3rem;
  box-shadow: 0 30px 80px rgba(0,0,0,0.9);
  animation: textReveal 0.3s ease;
}

/* Titre */
#dice-label {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--texte-dim);
}

/* Conteneur du dé */
#dice-face {
  width: 110px;
  height: 110px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Forme hexagonale (D20 stylisé) */
#dice-shape {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, var(--kaki), #1e1008);
  border: 2px solid var(--or);
  clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  box-shadow:
          inset 0 -6px 16px rgba(0,0,0,0.7),
          0 0 24px rgba(138,106,58,0.25);
}

/* Chiffre sur le dé */
#dice-number {
  position: relative;
  z-index: 1;
  font-family: 'Cinzel', serif;
  font-size: 2.8rem;
  font-weight: 600;
  color: var(--blanc);
  line-height: 1;
  text-shadow: 0 0 10px rgba(232,200,160,0.4);
  transition: color 0.4s, text-shadow 0.4s;
  min-width: 2ch;
  text-align: center;
}

/* Couleurs du score final */
#dice-number.score-low  { color: var(--rouge-vif); text-shadow: 0 0 18px rgba(192,57,43,0.8); }
#dice-number.score-mid  { color: var(--or);        text-shadow: 0 0 18px rgba(138,106,58,0.8); }
#dice-number.score-high { color: #80ff90;          text-shadow: 0 0 18px rgba(128,255,144,0.7); }

/* Animation de roulement */
@keyframes diceRoll {
  0%   { transform: rotate(0deg)   scale(1); }
  20%  { transform: rotate(22deg)  scale(1.06); }
  40%  { transform: rotate(-18deg) scale(0.94); }
  60%  { transform: rotate(12deg)  scale(1.04); }
  80%  { transform: rotate(-6deg)  scale(0.98); }
  100% { transform: rotate(0deg)   scale(1); }
}

#dice-face.rolling {
  animation: diceRoll 0.28s ease infinite;
}

/* Atterrissage du dé */
@keyframes diceLand {
  0%   { transform: scale(1.2); }
  55%  { transform: scale(0.9); }
  80%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

#dice-face.landing {
  animation: diceLand 0.45s cubic-bezier(.34,1.56,.64,1) forwards;
}

/* Barre de progression */
#dice-bar-wrap {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}

#dice-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--or);
  transition: width 0.7s ease, background 0.5s;
}

/* Étiquettes des tranches */
#dice-ranges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.dice-range-pill {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.7rem;
  border: 1px solid rgba(138,106,58,0.2);
  color: var(--texte-dim);
  border-radius: 1px;
  transition: border-color 0.35s, color 0.35s;
}

/* Tranche gagnante mise en évidence */
.dice-range-pill.active {
  border-color: var(--or);
  color: var(--or);
}

/* Texte narratif du résultat */
#dice-result-text {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--texte-dim);
  line-height: 1.6;
  min-height: 1.4em;
}

/* ═══════════════════════════════════════════════════════════════════
   PANNEAU ADMIN (test uniquement)
═══════════════════════════════════════════════════════════════════ */
#admin-btn {
  background: transparent;
  border: 1px solid #333;
  color: #555;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
#admin-btn:hover { color: var(--or); border-color: var(--or); }

#admin-panel {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
#admin-inner {
  background: #0e0e0e;
  border: 1px solid var(--or);
  border-radius: 8px;
  padding: 28px 32px;
  width: 460px;
  max-width: 95vw;
  display: flex; flex-direction: column; gap: 12px;
}
#admin-header {
  display: flex; justify-content: space-between; align-items: center;
}
#admin-header h2 { color: var(--or); font-family: 'Cinzel', serif; font-size: 16px; }
#close-admin-btn {
  background: transparent; border: none; color: var(--texte-dim);
  font-size: 18px; cursor: pointer;
}
#close-admin-btn:hover { color: var(--texte); }
#admin-subtitle { color: var(--texte-dim); font-size: 13px; }
#admin-input {
  background: #1a1a1a; border: 1px solid #333; border-radius: 4px;
  color: var(--texte); font-family: monospace; font-size: 14px;
  padding: 10px 12px; outline: none; width: 100%;
}
#admin-input:focus { border-color: var(--or); }
#admin-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px; max-height: 160px;
  overflow-y: auto;
}
.admin-pill {
  background: #1a1a1a; border: 1px solid #333;
  border-radius: 3px; padding: 3px 8px;
  font-family: monospace; font-size: 11px; color: var(--texte-dim);
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.admin-pill:hover { border-color: var(--or); color: var(--or); }
#admin-go-btn {
  background: var(--rouge); border: none; border-radius: 4px;
  color: var(--blanc); font-family: 'Cinzel', serif; font-size: 14px;
  padding: 10px; cursor: pointer; transition: background 0.2s;
}
#admin-go-btn:hover { background: var(--rouge-vif); }
#admin-error { color: var(--rouge-vif); font-size: 13px; min-height: 18px; }
