/* Grimoire v2 — DA « nuit d'encre & parchemin » + palettes par famille.
   Mobile-first (360-430 px), boutons larges, lisible en plein soleil. */

:root {
  --encre: #14100c;
  --encre-2: #1f1913;
  --encre-3: #2a2218;
  --parchemin: #ecdfb8;
  --parchemin-sombre: #cdb98a;
  --or: #c9a227;
  --or-clair: #ecd27a;
  --erreur: #e57373;
  --ok: #7fc98a;
  --c-commun: #9aa0a6;
  --c-inhabituel: #7fbf70;
  --c-rare: #5e9fe0;
  --c-epique: #b06fd4;
  --c-legendaire: #f6c344;
  --c-mythique: #ff5f52;
  /* Palette de scène (surchargée en JS par famille) */
  --sc-accent: var(--or);
  --sc-clair: var(--parchemin);
  --sc-fond: #171310;
  --sc-fond2: #241d15;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--encre);
  color: var(--parchemin);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }

.cache { display: none !important; }
.screen { position: fixed; inset: 0; }

/* ================= Boutons ================= */
.btn-or {
  padding: 15px 18px; font-size: 1.05rem; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, #e3c05e, var(--or));
  color: #241c0a; box-shadow: 0 2px 10px rgba(201, 162, 39, 0.25);
}
.btn-or:active { transform: scale(0.98); }
.btn-or:disabled { filter: grayscale(0.85); opacity: 0.5; box-shadow: none; }
.btn-large { width: 100%; margin-top: 14px; }
.btn-discret {
  width: 100%; margin-top: 10px; padding: 12px;
  background: none; border: 1px solid #4a3c22; border-radius: 12px;
  color: var(--parchemin-sombre); font-size: 0.95rem; cursor: pointer;
}
.btn-ligne { text-align: left; }
.btn-rond {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid #4a3c22; background: rgba(20, 16, 12, 0.75);
  color: var(--or-clair); font-size: 1.05rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
.btn-rond svg { width: 22px; height: 22px; }
.btn-rond.mute { color: var(--erreur); }
.erreur { color: var(--erreur); min-height: 1.2em; font-size: 0.9rem; }

/* ================= Join ================= */
#screen-join {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #241c12 0%, var(--encre) 70%);
}
.join-box { width: min(90vw, 340px); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.join-logo { width: 96px; margin: 0 auto; filter: drop-shadow(0 0 18px rgba(201, 162, 39, 0.35)); }
.join-box h1 { font-size: 2.3rem; letter-spacing: 0.14em; color: var(--or); font-weight: 600; }
.sous-titre { color: var(--parchemin-sombre); font-style: italic; margin-top: -10px; }
.join-box input {
  padding: 14px; font-size: 1.05rem; border-radius: 10px;
  border: 1px solid #4a3c22; background: var(--encre-2); color: var(--parchemin);
  text-align: center; font-family: inherit;
}
.join-box input:focus { outline: 2px solid var(--or); }

/* ================= Carte + brume ================= */
#map { position: absolute; inset: 0; background: #0d0b08; }
.leaflet-container { font: inherit; }

#brume { position: absolute; inset: 0; pointer-events: none; z-index: 640; overflow: hidden; opacity: 0.55; }
#brume .nappe {
  position: absolute; width: 160%; height: 60%;
  background:
    radial-gradient(ellipse 40% 55% at 25% 50%, rgba(210, 222, 228, 0.14), transparent 70%),
    radial-gradient(ellipse 34% 46% at 60% 40%, rgba(190, 205, 214, 0.10), transparent 70%),
    radial-gradient(ellipse 46% 60% at 85% 60%, rgba(210, 222, 228, 0.12), transparent 70%);
  will-change: transform;
}
#brume .n1 { top: 4%; left: -60%; animation: brume-derive 75s linear infinite; }
#brume .n2 { bottom: 8%; left: -30%; animation: brume-derive 115s linear infinite reverse; }
@keyframes brume-derive {
  0% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(38vw) translateY(-3vh); }
  100% { transform: translateX(0) translateY(0); }
}

#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 800;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: linear-gradient(180deg, rgba(20, 16, 12, 0.92), rgba(20, 16, 12, 0));
  pointer-events: none; font-weight: 700; color: var(--or);
}
#topbar em { font-style: normal; font-weight: 400; color: var(--parchemin-sombre); font-size: 0.85rem; }
.topbar-droite { display: flex; align-items: center; gap: 10px; }
#statut-gps { font-size: 1.1rem; }
#statut-gps.ok { color: var(--ok); }
#statut-gps.ko { color: var(--erreur); }

/* Marqueurs de spawn : sigil de famille + halo pulsant par rareté */
.marq { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.marq .sigil { position: relative; z-index: 2; filter: drop-shadow(0 0 4px #000); }
.marq .halo {
  position: absolute; inset: 3px; border-radius: 50%; z-index: 1;
  animation: halo-pulse 2.4s ease-in-out infinite;
}
.marq .marq-sym {
  position: absolute; bottom: -3px; right: -1px; z-index: 3;
  font-size: 13px; font-weight: 700; text-shadow: 0 0 4px #000, 0 0 8px #000;
}
.marq.r-commun { color: var(--c-commun); }
.marq.r-inhabituel { color: var(--c-inhabituel); }
.marq.r-rare { color: var(--c-rare); }
.marq.r-epique { color: var(--c-epique); }
.marq.r-legendaire { color: var(--c-legendaire); }
.marq.r-mythique { color: var(--c-mythique); }
.marq .halo { box-shadow: 0 0 10px 2px currentColor; opacity: 0.4; }
.marq.r-rare .halo { box-shadow: 0 0 14px 4px currentColor; opacity: 0.55; }
.marq.r-epique .halo { box-shadow: 0 0 18px 6px currentColor; opacity: 0.65; animation-duration: 1.8s; }
.marq.r-legendaire .halo { box-shadow: 0 0 24px 9px currentColor; opacity: 0.8; animation-duration: 1.4s; }
.marq.r-mythique .halo { box-shadow: 0 0 30px 12px currentColor; opacity: 0.9; animation-duration: 1s; }
@keyframes halo-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

.marqueur-joueur { background: none; border: none; text-align: center; }
.marqueur-joueur .point {
  width: 14px; height: 14px; margin: 0 auto; border-radius: 50%;
  background: var(--or); border: 2px solid #fff8e0; box-shadow: 0 0 8px var(--or);
}
.marqueur-joueur.autre .point { background: #7986cb; box-shadow: 0 0 8px #7986cb; }
.marqueur-joueur .nom { font-size: 11px; color: var(--parchemin); text-shadow: 0 0 4px #000; white-space: nowrap; }

/* ================= Bandeau narration ================= */
#bandeau-narration {
  position: absolute; top: calc(52px + env(safe-area-inset-top)); left: 10px; right: 10px;
  z-index: 900; padding: 13px 16px;
  background: linear-gradient(180deg, #efe2bc, #dcc79a);
  color: #3a2d14; border-radius: 6px; border: 1px solid #b39655;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(140, 110, 50, 0.25);
  font-style: italic; line-height: 1.35; font-size: 0.98rem;
  animation: derouler 0.4s ease-out;
}
#bandeau-narration::before {
  content: "❦ L'Archiviste"; display: block; font-style: normal;
  font-size: 0.72rem; letter-spacing: 0.1em; color: #7a5f2a; margin-bottom: 4px;
}
@keyframes derouler { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ================= Onglets ================= */
#tabbar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 850;
  display: flex; gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(16, 13, 9, 0.97) 65%, rgba(16, 13, 9, 0));
}
#tabbar .onglet {
  position: relative; flex: 1; padding: 8px 4px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em;
  background: var(--encre-2); color: var(--parchemin-sombre);
  border: 1px solid #3c301f; border-radius: 14px; cursor: pointer;
}
#tabbar .onglet .ic { width: 26px; height: 26px; }
#tabbar .onglet .ic svg { width: 26px; height: 26px; }
#tabbar .onglet.actif { color: var(--or-clair); border-color: var(--or); background: #2a2110; }
#tabbar .onglet.lumiere { animation: onglet-lueur 1s ease-in-out infinite; border-color: var(--or-clair); color: var(--or-clair); }
@keyframes onglet-lueur { 0%, 100% { box-shadow: 0 0 4px rgba(236, 210, 122, 0.3); } 50% { box-shadow: 0 0 18px rgba(236, 210, 122, 0.8); } }
.badge {
  position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px;
  border-radius: 9px; background: var(--c-mythique); color: #fff;
  font-size: 0.7rem; line-height: 18px; padding: 0 4px; font-weight: 700;
}

/* Panneaux d'onglet */
.tabpanel {
  position: absolute; inset: 0; z-index: 820;
  background: radial-gradient(ellipse at 50% 0%, #201a11 0%, var(--encre) 60%);
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}
.tab-defilable { height: 100%; overflow-y: auto; padding: calc(14px + env(safe-area-inset-top)) 16px 24px; -webkit-overflow-scrolling: touch; }
.page-entrante { animation: page-tourne 0.35s ease-out; }
@keyframes page-tourne {
  from { transform: perspective(900px) rotateY(9deg) translateX(4%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.grimoire-entete h2 { color: var(--or); font-size: 1.4rem; }
.grimoire-entete p { color: var(--parchemin-sombre); font-size: 0.92rem; margin-top: 2px; }
.jauge-xp { height: 5px; background: var(--encre-3); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.jauge-xp div { height: 100%; background: linear-gradient(90deg, var(--or), var(--or-clair)); border-radius: 3px; }
.section-titre {
  color: var(--parchemin-sombre); margin: 22px 0 10px; font-size: 0.95rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  border-bottom: 1px solid #33291a; padding-bottom: 5px;
}
.vide { color: var(--parchemin-sombre); font-style: italic; font-size: 0.95rem; }
.fin-de-page { text-align: center; color: #5c4d33; font-style: italic; font-size: 0.85rem; margin: 26px 0 8px; }

/* Grille de cartes du Grimoire */
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.mini-carte { position: relative; cursor: pointer; }
.mini-carte svg { width: 100%; height: auto; display: block; border-radius: 8px; }
.mini-carte .compte {
  position: absolute; top: 6px; left: 6px; background: rgba(0, 0, 0, 0.65);
  border-radius: 8px; padding: 1px 6px; font-size: 0.72rem; color: var(--parchemin);
}
.liste-materiaux { list-style: none; }
.liste-materiaux li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid #2c2418; font-size: 0.98rem; }
.liste-materiaux .qte { color: var(--or-clair); }

.zoom-carte {
  position: fixed; inset: 0; z-index: 1200; background: rgba(8, 6, 4, 0.92);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  animation: derouler 0.25s ease-out;
}
.zoom-contenu { width: min(78vw, 320px); max-height: 92vh; overflow-y: auto; }
.zoom-contenu svg.carte-creature { width: 100%; height: auto; }
.zoom-contenu .lore { margin-top: 12px; line-height: 1.45; font-style: italic; color: var(--parchemin); }

/* Compagnie */
.liste-veilleurs { list-style: none; }
.liste-veilleurs li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #2c2418; }
.liste-veilleurs .pastille { width: 9px; height: 9px; border-radius: 50%; background: #5a5142; flex: none; }
.liste-veilleurs .en-ligne .pastille { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.liste-veilleurs .nom { font-weight: 700; }
.liste-veilleurs .detail { margin-left: auto; color: var(--parchemin-sombre); font-size: 0.85rem; }
.flux, .journal { list-style: none; font-size: 0.94rem; }
.flux li, .journal li { padding: 8px 4px; border-bottom: 1px solid #241d12; line-height: 1.35; }
.flux .quand, .journal .quand { color: #7a6a48; font-size: 0.78rem; margin-right: 8px; font-variant-numeric: tabular-nums; }
.flux .ico { margin-right: 6px; }
.flux .k-capture .ico { color: var(--c-legendaire); }
.flux .k-fumble .ico, .flux .k-echec .ico { color: var(--erreur); }
.journal li { font-style: italic; color: var(--parchemin); }

/* ================= Fiche créature (bottom sheet) ================= */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
  background: var(--encre-2); color: var(--parchemin);
  border-top: 2px solid var(--or); border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 72vh; overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
  animation: sheet-monte 0.28s ease-out;
}
@keyframes sheet-monte { from { transform: translateY(30%); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet-fermer {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px;
  border-radius: 50%; border: 1px solid #4a3c22; background: var(--encre);
  color: var(--parchemin); font-size: 1rem; cursor: pointer; z-index: 5;
}
.fiche-entete { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; padding-right: 40px; }
.fiche-entete h2 { color: var(--parchemin); font-size: 1.3rem; }
.fiche-meta { color: var(--parchemin-sombre); font-size: 0.88rem; }
.lore { line-height: 1.45; margin-bottom: 10px; font-style: italic; }
.fiche-signature {
  font-size: 0.9rem; background: rgba(201, 162, 39, 0.08);
  border-left: 3px solid var(--or); padding: 8px 10px; margin-bottom: 10px; border-radius: 4px;
}
#fiche-distance { font-size: 0.95rem; margin: 10px 0 2px; color: var(--parchemin-sombre); }
#fiche-distance.ok { color: var(--ok); }

.sym { font-weight: 700; }
.sym.r-commun { color: var(--c-commun); }
.sym.r-inhabituel { color: var(--c-inhabituel); }
.sym.r-rare { color: var(--c-rare); }
.sym.r-epique { color: var(--c-epique); }
.sym.r-legendaire { color: var(--c-legendaire); }
.sym.r-mythique { color: var(--c-mythique); }

/* ================= La Rencontre (scène plein écran) ================= */
.overlay-scene {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(ellipse at 50% 24%, var(--sc-fond2) 0%, var(--sc-fond) 68%, #060404 100%);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: scene-ouvre 0.4s ease-out;
}
@keyframes scene-ouvre { from { opacity: 0; transform: perspective(900px) rotateY(-7deg); } to { opacity: 1; transform: none; } }
.scene-conteneur {
  min-height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(26px + env(safe-area-inset-bottom));
  max-width: 430px; margin: 0 auto;
}
.scene-phase { display: flex; flex-direction: column; }

.bulle-archiviste {
  background: linear-gradient(180deg, #efe2bc, #dcc79a); color: #3a2d14;
  border: 1px solid #b39655; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px;
  font-style: italic; line-height: 1.4; font-size: 0.97rem;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.45);
}
.bulle-archiviste .qui { display: block; font-style: normal; font-size: 0.7rem; letter-spacing: 0.1em; color: #7a5f2a; margin-bottom: 3px; }

.scene-carte { width: min(64vw, 258px); margin: 4px auto 10px; }
.scene-carte svg { width: 100%; height: auto; filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.6)); }
.apparition { animation: apparition 0.7s ease-out; }
@keyframes apparition { from { opacity: 0; transform: translateY(16px) scale(0.96); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.scene-lore { text-align: center; font-style: italic; color: var(--sc-clair); opacity: 0.9; line-height: 1.4; font-size: 0.96rem; }
.scene-alerte { text-align: center; color: var(--erreur); font-weight: 700; margin-top: 10px; }
.scene-note { text-align: center; color: var(--sc-clair); opacity: 0.75; font-size: 0.92rem; margin: 8px 0; }
.phase-titre { text-align: center; color: var(--sc-accent); letter-spacing: 0.12em; text-transform: uppercase; font-size: 1rem; margin-bottom: 12px; }

/* Phase d'approche */
.choix-approche { display: flex; flex-direction: column; gap: 10px; }
.btn-choix {
  text-align: left; padding: 14px 16px; border-radius: 14px; cursor: pointer;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--sc-accent);
  color: var(--sc-clair);
}
.btn-choix strong { display: block; font-size: 1.05rem; color: var(--sc-clair); }
.btn-choix span { display: block; font-size: 0.85rem; opacity: 0.75; margin-top: 3px; line-height: 1.3; }
.btn-choix:active { background: rgba(255, 255, 255, 0.06); }
.btn-choix:disabled { opacity: 0.4; }
.revelation {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.3); border: 1px dashed var(--sc-accent);
  border-radius: 10px; padding: 10px 14px; font-size: 0.92rem;
}
.revelation .bonus { color: var(--or-clair); font-weight: 700; }
.bandeau-jet {
  text-align: center; padding: 12px; border-radius: 10px; margin-bottom: 14px;
  font-size: 1.02rem; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--sc-accent);
  animation: derouler 0.3s ease-out;
}
.bandeau-jet.ok { border-color: var(--ok); }
.bandeau-jet.ko { border-color: var(--erreur); }

/* Phase de liaison : le cercle */
.cercle-zone { width: min(74vw, 300px); margin: 6px auto; touch-action: none; cursor: pointer; }
.cercle-zone svg { width: 100%; height: auto; display: block; }
#anneau-cible { filter: drop-shadow(0 0 5px rgba(201, 162, 39, 0.7)); }
#anneau-mobile { filter: drop-shadow(0 0 6px var(--sc-accent)); }
.flash-parfait { animation: flash-parfait 0.35s ease-out 2; }
@keyframes flash-parfait { 0%, 100% { stroke: #c9a227; stroke-width: 3; } 50% { stroke: #fff6d8; stroke-width: 7; } }

/* Phase de dénouement : le d20 3D */
.de3d-scene { perspective: 700px; display: flex; justify-content: center; margin: 12px 0 6px; }
.de3d {
  position: relative; width: 118px; height: 118px;
  transform-style: preserve-3d; color: #97783a;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
}
.de3d .face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 252, 238, 0.85), transparent 60%),
    linear-gradient(155deg, #efe2bc, #b6995c);
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  border: none;
}
.de3d .face svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; }
.de3d .face span {
  position: relative; z-index: 2; font-size: 2.6rem; font-weight: 700;
  color: #2c210b; text-shadow: 0 1px 0 rgba(255, 250, 230, 0.5);
  font-variant-numeric: tabular-nums;
}
.de3d.roule { animation: de-roule 0.55s linear infinite; }
@keyframes de-roule {
  0%   { transform: rotate3d(1, 1, 0, 0deg) translateY(0); }
  25%  { transform: rotate3d(1, 0.7, 0.3, 95deg) translateY(-14px); }
  50%  { transform: rotate3d(0.8, 1, 0.2, 190deg) translateY(0); }
  75%  { transform: rotate3d(1, 0.9, 0.4, 275deg) translateY(-8px); }
  100% { transform: rotate3d(1, 1, 0, 360deg) translateY(0); }
}
.de3d:not(.roule) { animation: de-pose 0.4s ease-out; }
@keyframes de-pose { from { transform: rotate3d(1, 1, 0, 40deg) scale(1.12); } to { transform: none; } }
.de3d.critique { filter: drop-shadow(0 0 26px var(--c-legendaire)); }
.de3d.critique .face span { color: #7a5a00; text-shadow: 0 0 14px #ffe9a0; }
.de3d.fumble { filter: drop-shadow(0 0 20px rgba(200, 40, 30, 0.8)); }
.de3d.fumble .face { background: radial-gradient(circle at 34% 28%, rgba(255, 240, 235, 0.5), transparent 60%), linear-gradient(155deg, #d8b8a8, #7c4a3a); }
.de3d.fumble .face span { color: #4a0f08; }
#denouement-detail { min-height: 1.4em; font-variant-numeric: tabular-nums; }
#denouement-detail em { color: var(--sc-accent); font-style: normal; font-size: 0.85em; }

/* Issues */
.issue { text-align: center; animation: derouler 0.4s ease-out; }
.issue h3 { font-size: 1.35rem; margin: 8px 0 12px; color: var(--sc-clair); }
.issue-capture h3 { color: var(--or-clair); }
.issue-capture.nat20 h3 { text-shadow: 0 0 18px var(--c-legendaire); }
.issue-fuite h3 { color: var(--parchemin-sombre); }
.butin { list-style: none; min-height: 8px; margin: 4px 0 8px; }
.butin li { padding: 5px 0; color: var(--or-clair); font-size: 1.02rem; animation: derouler 0.35s ease-out; }
.butin li::before { content: "✦ "; }
.xp-chip { color: var(--ok); font-weight: 700; }
.tremble { animation: tremble 0.4s ease-in-out; }
@keyframes tremble { 0%, 100% { transform: none; } 25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.dissolution .scene-carte, .dissolution .de3d-scene { animation: dissolution 1.4s ease-in forwards; }
@keyframes dissolution { to { opacity: 0.15; filter: blur(5px); } }
.liaison-anneaux { position: relative; height: 20px; }
.liaison-anneaux span {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  border: 2px solid var(--or-clair); border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: anneau-converge 1s ease-out forwards;
}
.liaison-anneaux span:nth-child(2) { animation-delay: 0.18s; }
.liaison-anneaux span:nth-child(3) { animation-delay: 0.36s; }
@keyframes anneau-converge {
  from { width: 130px; height: 130px; opacity: 0; }
  40% { opacity: 1; }
  to { width: 10px; height: 10px; opacity: 0; }
}

/* Cadre mythique animé (dans les cartes SVG) */
.cadre-mythique-int { animation: cadre-defile 6s linear infinite; }
@keyframes cadre-defile { to { stroke-dashoffset: -120; } }
svg.carte-creature.r-mythique { animation: myth-lueur 3s ease-in-out infinite; }
@keyframes myth-lueur {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(242, 193, 78, 0.35)); }
  50% { filter: drop-shadow(0 0 18px rgba(242, 193, 78, 0.7)); }
}

/* ================= Prologue ================= */
.overlay-prologue, .prologue { background: radial-gradient(ellipse at 50% 20%, #241c12 0%, #0e0b07 75%); }
.prologue-etape { display: flex; flex-direction: column; justify-content: center; }
.grimoire-dessin { width: min(52vw, 210px); margin: 0 auto 18px; }
.grimoire-dessin svg { width: 100%; height: auto; }
.trace-grimoire path { stroke-dasharray: 300; stroke-dashoffset: 300; animation: trace 2.2s ease-out forwards; }
.trace-grimoire path:nth-child(2) { animation-delay: 0.25s; }
.trace-grimoire path:nth-child(3) { animation-delay: 0.9s; }
.trace-grimoire path:nth-child(4) { animation-delay: 0.6s; }
.trace-grimoire path:nth-child(5) { animation-delay: 1.3s; }
@keyframes trace { to { stroke-dashoffset: 0; } }
.prologue-carte {
  background: linear-gradient(180deg, #efe2bc, #d8c294); color: #33270f;
  border-radius: 10px; border: 1px solid #b39655;
  padding: 20px 18px; line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(140, 110, 50, 0.2);
}
.prologue-carte h3 { color: #6d5116; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.85rem; margin-bottom: 8px; }
.prologue-points { display: flex; gap: 8px; justify-content: center; margin: 16px 0 4px; }
.prologue-points span { width: 8px; height: 8px; border-radius: 50%; background: #4a3c22; }
.prologue-points span.actif { background: var(--or); box-shadow: 0 0 6px var(--or); }

.choix-classes { display: flex; flex-direction: column; gap: 12px; }
.carte-classe {
  text-align: left; padding: 15px 16px; cursor: pointer;
  background: var(--encre-2); border: 1px solid #4a3c22; border-radius: 14px;
  color: var(--parchemin); display: flex; flex-direction: column; gap: 3px;
}
.carte-classe .sceau { font-size: 1.4rem; color: var(--or-clair); }
.carte-classe strong { font-size: 1.15rem; color: var(--or); }
.carte-classe em { font-size: 0.9rem; color: var(--parchemin-sombre); }
.carte-classe .bonus { font-size: 0.9rem; color: var(--ok); font-weight: 700; }
.carte-classe.choisie { border-color: var(--or); box-shadow: 0 0 16px rgba(201, 162, 39, 0.4); }
.onglet-lumiere {
  text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--or-clair);
  letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 16px;
  animation: onglet-lueur 1.2s ease-in-out infinite;
  padding: 12px; border: 1px solid var(--or); border-radius: 14px;
}

/* ================= Accessibilité mouvement ================= */
@media (prefers-reduced-motion: reduce) {
  #brume { display: none; }
  .de3d.roule { animation: de-roule 1.4s linear infinite; }
  .marq .halo { animation: none; }
}
