/* ============================================================================
   LE CRISTAL MAUDIT™ — feuille de style partagée
   Palette Renaissance sombre · Cinzel + Crimson Text
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --or:        #d4af37;
  --or-pale:   #e7d6a8;
  --parchemin: #e6ddd4;
  --encre:     #0b0a10;
  --nuit:      #12111c;
  --ardoise:   #1b1a26;
  --sang:      #b42e2e;
  --sang-vif:  #ff4757;
  --vert:      #6fbf87;
  --pourpre:   #9c5bb8;
  --acier:     #5dade2;
  --bordure:   rgba(212, 175, 55, 0.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(212,175,55,0.07), transparent 60%),
    linear-gradient(160deg, #07060c 0%, #12111c 40%, #1a1420 75%, #07060c 100%);
  background-attachment: fixed;
  color: var(--parchemin);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 17px;
  line-height: 1.65;
  min-height: 100vh;
}

h1, h2, h3, h4, .cinzel { font-family: 'Cinzel', Georgia, serif; font-weight: 600; }

a { color: var(--or); }

.enveloppe { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------------------------------------------------------------- entête */
.entete {
  text-align: center;
  background: rgba(18, 17, 28, 0.78);
  border: 1px solid var(--bordure);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
  backdrop-filter: blur(6px);
}

.titre-jeu {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.7rem, 4.2vw, 2.7rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(45deg, #8b6f2e, #ffd970, #d4af37);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--or);
}

.sous-titre { color: #9a8a6d; font-style: italic; margin-top: 4px; }

.fil-ariane { color: #7d7290; font-size: 0.88rem; margin-top: 8px; letter-spacing: 0.05em; }

/* -------------------------------------------------------------- jauges */
.jauge { height: 9px; background: rgba(255,255,255,0.07); border-radius: 5px; overflow: hidden; }
.jauge > i {
  display: block; height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, #8b6f2e, var(--or), #ffe89a);
  transition: width 0.7s cubic-bezier(.2,.8,.2,1);
}
.jauge.corrompue > i { background: linear-gradient(90deg, #5a1010, var(--sang-vif), #ff8a7a); }
.jauge.vertueuse > i { background: linear-gradient(90deg, #1e5c38, var(--vert), #bff3d0); }

/* ------------------------------------------------------------------ HUD */
.hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  background: rgba(27, 26, 38, 0.62);
  border: 1px solid rgba(93, 173, 226, 0.22);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.trait { background: rgba(11, 10, 16, 0.55); border-radius: 8px; padding: 9px 11px; }
.trait b { display: block; font-family: 'Cinzel', serif; font-size: 0.72rem; letter-spacing: 0.08em;
           text-transform: uppercase; color: #a99a7d; margin-bottom: 6px; font-weight: 600; }
.trait .valeur { float: right; color: var(--or-pale); font-weight: 600; font-size: 0.72rem; }

/* -------------------------------------------------------------- dédale */
.scene {
  position: relative;
  border: 1px solid var(--bordure);
  border-radius: 14px;
  overflow: hidden;
  background: #05050a;
  box-shadow: 0 18px 45px rgba(0,0,0,0.6), inset 0 0 60px rgba(0,0,0,0.7);
}

#dedale { display: block; width: 100%; height: min(64vh, 620px); touch-action: none; }

.bandeau-scene {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(6,6,12,0.9), transparent);
  font-size: 0.86rem; color: #b8a882; pointer-events: none;
}
.bandeau-scene .compteur { color: var(--or-pale); font-family: 'Cinzel', serif; }

.aide-touches { color: #7d7290; font-size: 0.85rem; text-align: center; margin: 10px 0 18px; }
.aide-touches kbd {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  border-radius: 4px; padding: 1px 6px; font-family: monospace; color: var(--or-pale);
}

/* manette tactile */
#dpad { display: none; margin: 14px auto 4px; width: min(300px, 92%); }
#dpad .croix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#dpad button {
  background: rgba(27,26,38,0.9); border: 1px solid var(--bordure); color: var(--or-pale);
  border-radius: 10px; padding: 16px 0; font-size: 1.1rem; cursor: pointer;
  font-family: 'Cinzel', serif; user-select: none; -webkit-user-select: none;
}
#dpad button:active { background: rgba(212,175,55,0.24); }
#dpad .agir { grid-column: 1 / -1; margin-top: 8px; }
@media (hover: none) and (pointer: coarse) { #dpad { display: block; } }

/* -------------------------------------------------------------- modale */
.voile {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 4, 9, 0.86);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; overflow-y: auto;
  animation: apparait .35s ease;
}
.voile[hidden] { display: none !important; }

.parchemin {
  max-width: 780px; width: 100%;
  background: linear-gradient(150deg, rgba(28,24,20,0.98), rgba(18,17,28,0.98));
  border: 1px solid rgba(212,175,55,0.42);
  border-radius: 15px;
  padding: 28px 30px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.75);
  max-height: 92vh; overflow-y: auto;
  animation: monte .4s cubic-bezier(.2,.9,.25,1);
}

.parchemin .lieu {
  font-family: 'Cinzel', serif; color: var(--or); font-size: 1.25rem;
  text-align: center; margin-bottom: 3px;
}
.parchemin .date {
  text-align: center; color: #8d8069; font-style: italic; font-size: 0.92rem;
  padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid rgba(212,175,55,0.2);
}
.parchemin .recit { margin-bottom: 16px; }
.parchemin .recit p + p { margin-top: 12px; }

.replique {
  background: rgba(180, 46, 46, 0.16);
  border-left: 4px solid var(--sang);
  border-radius: 0 10px 10px 0;
  padding: 15px 18px; margin: 16px 0;
  font-style: italic; color: #fff;
}
.replique b { font-style: normal; color: #ffbfae; }

.cristal { color: var(--sang-vif); font-weight: 700; text-shadow: 0 0 12px rgba(255,71,87,0.55);
           animation: pulseCristal 3s ease-in-out infinite; }

/* ------------------------------------------------------------- boutons */
.choix { display: block; width: 100%; text-align: left; cursor: pointer;
  background: linear-gradient(45deg, rgba(212,175,55,0.16), rgba(139,115,85,0.1));
  border: 1px solid rgba(212,175,55,0.45);
  color: #f4ecdd; padding: 15px 18px; margin: 11px 0; border-radius: 10px;
  font-family: 'Crimson Text', serif; font-size: 1.02rem; line-height: 1.5;
  transition: transform .18s ease, background .25s ease, border-color .25s ease;
  position: relative; overflow: hidden;
}
.choix::after {
  content: ''; position: absolute; top: 0; left: -120%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.13), transparent);
  transition: left .7s ease;
}
.choix:hover::after { left: 120%; }
.choix:hover { background: linear-gradient(45deg, rgba(212,175,55,0.3), rgba(139,115,85,0.18));
               border-color: var(--or); transform: translateY(-2px); }
.choix .marque {
  float: right; margin-left: 12px; font-size: 0.7rem; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 11px; font-weight: 700; font-family: 'Cinzel', serif;
  text-transform: uppercase;
}
.m-noble  { background: rgba(111,191,135,0.22); color: #9fe0b4; }
.m-sombre { background: rgba(244,67,54,0.2);   color: #ff9a90; }
.m-neutre { background: rgba(158,158,158,0.2); color: #cfcfcf; }
.m-ruse   { background: rgba(156,39,176,0.22); color: #dda6ee; }
.m-brave  { background: rgba(255,193,7,0.2);   color: #ffd98a; }

.bouton {
  display: inline-block; cursor: pointer; text-decoration: none;
  background: linear-gradient(45deg, #221f2e, #2f2a3d);
  border: 1px solid var(--bordure); color: var(--or-pale);
  padding: 12px 22px; margin: 6px; border-radius: 9px;
  font-family: 'Cinzel', serif; font-size: 0.95rem;
  transition: transform .2s ease, background .25s ease;
}
.bouton:hover { background: linear-gradient(45deg, #2f2a3d, #3b3450); transform: translateY(-2px); }
.bouton.principal { background: linear-gradient(45deg, #7a5f1e, #b8912f); color: #1a1408; border-color: #e2c66a; font-weight: 600; }
.bouton[disabled], .bouton.verrou { opacity: 0.42; pointer-events: none; }

.rangee-boutons { text-align: center; margin-top: 22px; }

/* ------------------------------------------------------------- panneaux */
.panneau {
  background: rgba(18, 17, 28, 0.72);
  border: 1px solid var(--bordure);
  border-radius: 13px; padding: 20px 22px; margin-bottom: 16px;
}
.panneau > h3 {
  font-size: 1.05rem; color: var(--or); letter-spacing: 0.05em;
  margin-bottom: 12px; text-transform: uppercase;
}

.grille-chapitres { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 14px; }

.carte-chapitre {
  display: block; text-decoration: none; color: inherit;
  background: linear-gradient(150deg, rgba(34,30,44,0.92), rgba(16,15,24,0.92));
  border: 1px solid var(--bordure); border-radius: 12px; padding: 18px;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.carte-chapitre:hover { transform: translateY(-3px); border-color: var(--or); box-shadow: 0 12px 28px rgba(0,0,0,0.5); }
.carte-chapitre .num { font-family: 'Cinzel', serif; color: #7d7290; font-size: 0.78rem; letter-spacing: 0.14em; }
.carte-chapitre h4 { color: var(--or-pale); font-size: 1.12rem; margin: 4px 0 6px; }
.carte-chapitre .lieu-date { color: #8d8069; font-style: italic; font-size: 0.88rem; }
.carte-chapitre .etat { margin-top: 12px; font-size: 0.85rem; color: #a99a7d; }
.carte-chapitre.verrouillee { opacity: 0.45; pointer-events: none; }
.carte-chapitre.finie { border-color: rgba(111,191,135,0.5); }

.liste-nue { list-style: none; }
.liste-nue li { padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.95rem; }
.liste-nue li:last-child { border-bottom: none; }

.etiquette {
  display: inline-block; font-family: 'Cinzel', serif; font-size: 0.7rem; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 11px; border: 1px solid var(--bordure);
  color: var(--or-pale); margin: 3px 4px 3px 0;
}

.rumeur { font-style: italic; color: #a396b8; border-left: 3px solid rgba(156,91,184,0.5);
          padding-left: 12px; margin: 9px 0; }

.chiffre-cle { font-family: 'Cinzel', serif; font-size: 2.3rem; color: var(--or); line-height: 1.1; }
.chiffre-legende { color: #8d8069; font-size: 0.85rem; }

.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.sortie-secours { background: rgba(111,191,135,0.1); border: 1px solid rgba(111,191,135,0.34);
                  border-radius: 10px; padding: 14px 16px; margin-top: 14px; }
.gain { background: rgba(212,175,55,0.1); border: 1px solid rgba(212,175,55,0.3);
        border-radius: 10px; padding: 14px 16px; margin-top: 14px; }

.discret { color: #7d7290; font-size: 0.85rem; }

/* ------------------------------------------------------------ animations */
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }
@keyframes monte { from { opacity: 0; transform: translateY(26px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulseCristal { 0%,100% { opacity: 1; } 50% { opacity: .68; text-shadow: 0 0 22px rgba(255,71,87,0.9); } }
@keyframes lueurOr { from { box-shadow: 0 0 6px rgba(212,175,55,.4); } to { box-shadow: 0 0 20px rgba(212,175,55,.75); } }

.arrive { animation: monte .55s cubic-bezier(.2,.9,.25,1) both; }
.arrive-2 { animation: monte .55s .1s cubic-bezier(.2,.9,.25,1) both; }
.arrive-3 { animation: monte .55s .2s cubic-bezier(.2,.9,.25,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .enveloppe { padding: 14px 12px 40px; }
  .parchemin { padding: 20px 18px; }
  #dedale { height: 52vh; }
}
