.cdm-view {
  --cdm-accent: var(--interactive-accent, #7c5cd6);
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  height: 100%;
}

/* barre d'outils */
.cdm-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--background-modifier-border);
  background: var(--background-secondary);
  font-size: 13px;
}
.cdm-search { width: 190px; }
.cdm-lab { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); white-space: nowrap; }
.cdm-check { cursor: pointer; }
.cdm-btn { cursor: pointer; white-space: nowrap; }
.cdm-compteur { margin-left: auto; color: var(--text-faint); white-space: nowrap; }

/* zone de carte */
.cdm-corps { flex: 1; display: flex; min-height: 0; }
.cdm-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
  background-color: var(--background-primary);
  background-image: radial-gradient(var(--background-modifier-border) 1px, transparent 1px);
  background-size: 22px 22px;
  touch-action: none;
}
.cdm-canvas.is-drag { cursor: grabbing; }
.cdm-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cdm-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cdm-branche { fill: none; opacity: 0.55; stroke-linecap: round; }

/* nœuds */
.cdm-node {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--background-primary));
  color: var(--text-normal);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.12s, box-shadow 0.12s;
}
.cdm-node:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
.cdm-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.cdm-group {
  font-weight: 600;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 30%, var(--background-primary));
}
.cdm-racine {
  justify-content: center;
  padding: 0 20px;
  border-radius: 999px;
  border-width: 2px;
  font-size: 17px;
  font-weight: 700;
  background: color-mix(in srgb, var(--c) 28%, var(--background-primary));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.cdm-racine .cdm-label { flex: none; }
.cdm-note.is-orphelin { border-style: dashed; }
.cdm-vignette {
  height: calc(100% - 6px);
  aspect-ratio: 1;
  margin-left: -6px;
  border-radius: 6px;
  object-fit: cover;
  object-position: top;
  flex: none;
}
.cdm-nb {
  flex: none;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.cdm-dir { flex: none; color: var(--text-muted); font-size: 12px; }

/* mise en évidence */
.cdm-world.has-actif .cdm-node:not(.is-lit),
.cdm-world.has-query .cdm-note:not(.is-hit):not(.is-lit) { opacity: 0.25; }
.cdm-world.has-actif .cdm-branche { opacity: 0.2; }
.cdm-node.is-actif { box-shadow: 0 0 0 3px var(--c); }
.cdm-node.is-hit { box-shadow: 0 0 0 3px var(--text-highlight-bg, #ffd54a); }

/* liens entre notes */
.cdm-lien { fill: none; stroke-linecap: round; }
.cdm-lien.is-fond { stroke: var(--text-faint); stroke-width: 1; opacity: 0.22; }
.cdm-lien.is-sortant { stroke: var(--cdm-accent); stroke-width: 2; opacity: 0.9; }
.cdm-lien.is-entrant { stroke: var(--cdm-accent); stroke-width: 1.6; stroke-dasharray: 5 5; opacity: 0.8; }

/* fiche latérale */
.cdm-panel {
  width: 290px;
  flex: none;
  overflow-y: auto;
  padding: 14px;
  border-left: 1px solid var(--background-modifier-border);
  border-top: 4px solid var(--c);
  background: var(--background-secondary);
  font-size: 13px;
}
.cdm-panel[hidden] { display: none; }
.cdm-p-tete { display: flex; align-items: flex-start; gap: 8px; }
.cdm-p-titre { flex: 1; font-size: 18px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.cdm-p-x { flex: none; padding: 0 8px; font-size: 16px; }
.cdm-p-cat { margin: 2px 0 10px; color: var(--c); font-weight: 600; }
.cdm-p-img { display: block; width: 100%; max-height: 220px; object-fit: cover; object-position: top; border-radius: 8px; margin-bottom: 10px; }
.cdm-p-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cdm-p-champs { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0 0 12px; }
.cdm-p-champs dt { color: var(--text-muted); }
.cdm-p-champs dd { margin: 0; overflow-wrap: anywhere; }
.cdm-p-sec { margin: 12px 0 6px; color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.cdm-p-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cdm-chip {
  height: auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--background-primary));
  color: var(--text-normal);
  font-size: 12px;
  cursor: pointer;
  box-shadow: none;
}
.cdm-chip:hover { background: color-mix(in srgb, var(--c) 32%, var(--background-primary)); }
.cdm-p-vide { color: var(--text-faint); font-style: italic; }

@media (max-width: 700px) {
  .cdm-corps { flex-direction: column; }
  .cdm-panel { width: auto; max-height: 45%; border-left: 0; }
}

/* bulle de résumé au survol d'une note dans l'explorateur */
.cdm-bulle {
  position: fixed;
  z-index: var(--layer-popover, 30);
  left: 0;
  top: 0;
  width: 320px;
  max-height: calc(100vh - 16px);
  overflow: hidden;
  border: 1px solid var(--background-modifier-border);
  border-top: 4px solid var(--c);
  border-radius: 10px;
  background: var(--background-secondary);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.15s, transform 0.15s;
}
.cdm-bulle.is-visible { opacity: 1; transform: none; }
.cdm-b-img { display: block; width: 100%; height: 190px; object-fit: cover; object-position: top; }
.cdm-b-corps { padding: 12px 14px 14px; }
.cdm-b-corps .cdm-p-champs { margin-bottom: 10px; }
.cdm-b-resume {
  padding-top: 10px;
  border-top: 1px solid var(--background-modifier-border);
  color: var(--text-muted);
  line-height: 1.45;
}
/* l'infobulle native d'Obsidian (dates) ne se superpose plus à la fiche dans l'explorateur */
body.cdm-sans-infobulle:has(.nav-files-container .tree-item-self:hover) > .tooltip { display: none !important; }

.cdm-bulle .cdm-p-sec { margin-top: 10px; }
.cdm-bulle .cdm-chip { display: inline-block; cursor: default; line-height: 1.3; }
.cdm-chip-plus { --c: var(--text-faint); color: var(--text-muted); }
/* bouton et fenêtre de synthèse */
.cdm-btn-synthese.is-vide { opacity: 0.45; }
.cdm-btn-synthese:not(.is-vide) { color: var(--interactive-accent); }
.cdm-modal-synthese { width: min(560px, 92vw); }
.cdm-s-aide { margin: 0 0 10px; color: var(--text-muted); font-size: 13px; }
.cdm-s-zone { width: 100%; height: 170px; resize: vertical; line-height: 1.5; }
.cdm-s-compteur { margin: 4px 0 6px; color: var(--text-faint); font-size: 12px; text-align: right; }
/* illustration cadrée (mini-fiche et fenêtre de synthèse) */
.cdm-b-cadre { height: 190px; overflow: hidden; }
.cdm-b-cadre .cdm-b-img { height: 100%; max-width: none; }
.cdm-s-cadre {
  box-sizing: content-box;
  width: 318px;
  margin: 0 auto;
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.cdm-s-cadre:active { cursor: grabbing; }
.cdm-s-cadre.is-vide { cursor: default; display: flex; align-items: center; justify-content: center; }
.cdm-s-vide { color: var(--text-faint); font-style: italic; }
.cdm-s-zoom { display: block; width: 318px; margin: 0 auto 8px; }
.cdm-s-cadre + .cdm-s-compteur { text-align: center; }
.cdm-s-vignettes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0; }
.cdm-s-vignette {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  border: 1px solid var(--background-modifier-border);
  object-fit: cover;
  object-position: top;
  cursor: pointer;
}
.cdm-s-vignette:hover { border-color: var(--interactive-accent); }
.cdm-s-actions { border-top: 0; padding-top: 4px; }
.cdm-modal-synthese .cdm-p-sec { margin-top: 14px; }
/* ---------- images flottantes dans les notes ---------- */
.markdown-rendered .internal-embed.image-embed[alt*="droite"],
.markdown-source-view.mod-cm6 .cm-content > .image-embed[alt*="droite"] {
  float: right;
  clear: right;
  margin: 4px 0 12px 20px;
  max-width: 75%;
}
.markdown-rendered .internal-embed.image-embed[alt*="gauche"],
.markdown-source-view.mod-cm6 .cm-content > .image-embed[alt*="gauche"] {
  float: left;
  clear: left;
  margin: 4px 20px 12px 0;
  max-width: 75%;
}
.markdown-rendered .internal-embed.image-embed[alt*="centre"],
.markdown-source-view.mod-cm6 .cm-content > .image-embed[alt*="centre"] {
  display: block;
  text-align: center;
}
.internal-embed.image-embed[alt*="centre"] img { margin-left: auto; margin-right: auto; display: block; }
.internal-embed.image-embed[alt*="droite"] img,
.internal-embed.image-embed[alt*="gauche"] img { border-radius: 8px; display: block; }
/* les titres repartent sous l'image au lieu de s'enrouler autour */
.markdown-rendered :is(h1, h2, h3, hr), .markdown-source-view.mod-cm6 .cm-line:is(.HyperMD-header-1, .HyperMD-header-2) { clear: both; }

.cdm-img-barre {
  position: fixed;
  z-index: var(--layer-popover, 30);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
  background: var(--background-secondary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.cdm-img-barre .clickable-icon.is-active { color: var(--interactive-accent); background: var(--background-modifier-hover); }
.cdm-img-sep { width: 1px; height: 18px; margin: 0 3px; background: var(--background-modifier-border); }
.cdm-img-taille { padding: 0 6px; color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.cdm-img-poignee {
  position: fixed;
  z-index: var(--layer-popover, 30);
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid #fff;
  background: var(--interactive-accent);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  cursor: nwse-resize;
  touch-action: none;
}
.cdm-img-poignee.is-gauche { cursor: nesw-resize; }

/* ---------- sac de références ---------- */
.cdm-sac-btn.is-depot, .cdm-sac.is-depot, .cdm-sac .is-depot {
  color: var(--text-on-accent, #fff);
  background: var(--interactive-accent) !important;
}
.cdm-sac.is-depot { background: color-mix(in srgb, var(--interactive-accent) 18%, transparent) !important; color: inherit; }
.cdm-sac-tete { align-items: center; }
.cdm-sac-fil { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; }
.cdm-sac-maillon { padding: 2px 7px; border-radius: 6px; color: var(--text-muted); cursor: pointer; }
.cdm-sac-maillon:hover { background: var(--background-modifier-hover); color: var(--text-normal); }
.cdm-sac-maillon.is-ici { color: var(--text-normal); font-weight: 650; }
.cdm-sac-sep { color: var(--text-faint); }
.cdm-sac-dossier { border-style: dashed; }
.cdm-sac-dossier-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  color: var(--interactive-accent);
  background: color-mix(in srgb, var(--interactive-accent) 10%, transparent);
  --icon-size: 36px;
}
.cdm-sac-dossier .cdm-sac-legende { font-weight: 600; }
.cdm-sac-ou { padding: 0 6px 5px; color: var(--text-faint); font-size: 10px; text-align: center; }
.cdm-sac { display: flex; flex-direction: column; gap: 8px; outline: none; }
.cdm-sac-tete { display: flex; gap: 6px; }
.cdm-sac-tete input[type="search"] { flex: 1; min-width: 0; }
.cdm-sac-aide { color: var(--text-faint); font-size: 11px; line-height: 1.4; }
.cdm-sac-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cdm-sac-carte {
  border-radius: 8px;
  border: 1px solid var(--background-modifier-border);
  background: var(--background-primary);
  overflow: hidden;
  cursor: pointer;
}
.cdm-sac-carte:hover { border-color: var(--interactive-accent); }
.cdm-sac-carte img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; object-position: top; }
.cdm-sac-legende { padding: 4px 6px 5px; font-size: 11px; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
.cdm-modal-nom { width: min(420px, 92vw); }
.cdm-nom-img { display: block; max-width: 100%; max-height: 260px; margin: 0 auto 10px; border-radius: 8px; }
.cdm-nom-champ { width: 100%; }
.cdm-nom-champ.is-invalid { border-color: var(--text-error); }
/* choix de références à ranger dans un dossier */
.cdm-modal-choix { width: min(680px, 94vw); }
.cdm-choix-champ { width: 100%; margin-bottom: 10px; }
.cdm-choix-grille { max-height: 55vh; overflow-y: auto; padding: 2px; }
.cdm-sac-carte.is-choisie { border-color: var(--interactive-accent); box-shadow: 0 0 0 2px var(--interactive-accent); }
.cdm-sac-carte.is-choisie .cdm-sac-legende { color: var(--interactive-accent); font-weight: 650; }
/* dossiers du sac : couleur, image d'affichage, étiquette sur les références rangées */
.cdm-sac-carte { position: relative; }
.cdm-sac-dossier { --d: var(--interactive-accent); border: 1.5px solid var(--d); }
.cdm-sac-dossier-ico { color: var(--d); background: color-mix(in srgb, var(--d) 12%, transparent); }
.cdm-sac-dossier .cdm-sac-legende { background: color-mix(in srgb, var(--d) 16%, transparent); }
.cdm-sac-dossier-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  display: flex;
  padding: 4px;
  border-radius: 6px;
  background: var(--d);
  color: #fff;
  --icon-size: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.cdm-sac-carte.est-rangee { border: 1px solid var(--d); }
.cdm-sac-carte.est-rangee .cdm-sac-ou {
  position: absolute;
  top: 5px;
  left: 5px;
  max-width: calc(100% - 10px);
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--d);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.cdm-couleurs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cdm-couleur { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.cdm-couleur:hover, .cdm-couleur.is-choisie { border-color: var(--text-normal); }
/* vue d'ensemble de toutes les références */
.cdm-modal-tout { width: min(980px, 96vw); }
.cdm-tout-corps { max-height: 68vh; overflow-y: auto; padding: 2px 4px 2px 2px; margin-bottom: 8px; }
.cdm-tout-section { margin-bottom: 18px; }
.cdm-tout-titre {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-left: 4px solid var(--d);
  border-radius: 6px;
  background: color-mix(in srgb, var(--d) 14%, transparent);
  font-weight: 650;
  cursor: pointer;
}
.cdm-tout-titre:hover { background: color-mix(in srgb, var(--d) 26%, transparent); }
.cdm-tout-pastille { width: 10px; height: 10px; border-radius: 50%; background: var(--d); }
.cdm-tout-nb { margin-left: auto; color: var(--text-muted); font-size: 12px; font-weight: 400; }
.cdm-modal-tout .cdm-sac-grille { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.cdm-p-resume { margin-bottom: 4px; }

/* bouton « Publier » en bas d'une barre latérale */
.cdm-publier {
  flex: 0 0 auto;
  order: 999;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--background-modifier-border);
  background: var(--background-secondary);
}
.cdm-publier-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; font-weight: 650; }
.cdm-publier-ico { display: flex; }
.cdm-publier-lien { color: var(--text-muted); font-size: 11px; text-align: center; overflow-wrap: anywhere; cursor: pointer; }
.cdm-publier-lien.est-inactif { color: var(--text-faint); cursor: default; text-decoration: none; }
/* icône « Publier » du ruban : pulse pendant l'envoi */
.cdm-ruban-publier.cdm-publication { color: var(--interactive-accent); animation: cdm-pulse 1s ease-in-out infinite; pointer-events: none; }
@keyframes cdm-pulse { 50% { opacity: 0.35; } }
/* mini-fiche : reste ouverte sous la souris, liens rangés par dossier */
.cdm-bulle { pointer-events: auto; overflow-y: auto; }
.cdm-b-liens { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--background-modifier-border); }
.cdm-b-groupe { margin-top: 6px; }
.cdm-b-groupe-nom {
  margin-bottom: 4px;
  color: var(--c);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cdm-bulle .cdm-b-groupe .cdm-chip { cursor: pointer; }
/* ---------- éditeur joueurs ---------- */
.cdm-ed { display: flex; flex-direction: column; height: 100%; padding: 0 !important; overflow: hidden; }
.cdm-ed-barre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--background-modifier-border);
  background: var(--background-secondary);
  font-size: 13px;
}
.cdm-ed-lab { color: var(--text-muted); }
.cdm-ed-apercu { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; cursor: pointer; }
.cdm-ed-bilan { margin-left: auto; color: var(--text-faint); }
.cdm-ed-colonnes { flex: 1; display: flex; min-height: 0; }
.cdm-ed-liste {
  width: 240px;
  flex: none;
  overflow-y: auto;
  padding: 8px;
  border-right: 1px solid var(--background-modifier-border);
  background: var(--background-secondary);
  font-size: 13px;
}
.cdm-ed-dossier { margin: 10px 0 3px; padding-left: 6px; border-left: 3px solid var(--c); color: var(--c); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.cdm-ed-note { display: flex; align-items: center; gap: 4px; padding: 1px 6px 1px 2px; border-radius: 6px; cursor: pointer; }
.cdm-ed-note:hover { background: var(--background-modifier-hover); }
.cdm-ed-note.est-active { background: var(--background-modifier-hover); font-weight: 600; box-shadow: inset 3px 0 0 var(--interactive-accent); }
.cdm-ed-note.est-cachee .cdm-ed-nom { color: var(--text-faint); text-decoration: line-through; }
.cdm-ed-nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdm-ed-partiel { color: var(--interactive-accent); }
.cdm-ed-oeil { flex: none; --icon-size: 15px; padding: 4px; }
.cdm-ed-page { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 28px 80px; }
.cdm-ed-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.cdm-ed-titre { flex: 1; font-size: 24px; font-weight: 700; }
.cdm-ed-aide, .cdm-ed-avis { margin-bottom: 14px; color: var(--text-muted); font-size: 12px; }
.cdm-ed-avis { padding: 10px 14px; border-radius: 8px; background: var(--background-secondary); font-size: 14px; }
.cdm-ed-bloc { display: flex; align-items: flex-start; gap: 6px; max-width: 860px; padding: 2px 6px 2px 0; border-radius: 6px; border-left: 3px solid transparent; }
.cdm-ed-bloc:hover { background: var(--background-modifier-hover); }
.cdm-ed-bloc .cdm-ed-oeil { margin-top: 2px; color: var(--text-faint); }
.cdm-ed-bloc:hover .cdm-ed-oeil { color: var(--text-normal); }
.cdm-ed-bloc.est-cache { border-left-color: var(--text-error, #e0625e); background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--text-error, #e0625e) 7%, transparent) 8px 16px); }
.cdm-ed-bloc.est-cache .cdm-ed-corps { opacity: 0.45; }
.cdm-ed-bloc.est-cache .cdm-ed-oeil { color: var(--text-error, #e0625e); }
.cdm-ed-bloc.est-herite { border-left-style: dashed; }
.cdm-ed-corps { flex: 1; min-width: 0; }
.cdm-ed-corps > :first-child { margin-top: 2px; }
.cdm-ed-corps > :last-child { margin-bottom: 2px; }
.cdm-ed-corps p, .cdm-ed-corps ul, .cdm-ed-corps ol { margin-block: 4px; }
.cdm-ed-corps.est-apercu { max-width: 820px; }
.cdm-ed-corps.est-apercu p { margin-block: 0 1em; }
.cdm-ed-etiquette { color: var(--text-faint); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.cdm-ed-synthese { padding: 8px 12px; margin: 4px 0 10px; border-left: 3px solid var(--interactive-accent); border-radius: 0 6px 6px 0; background: var(--background-secondary); color: var(--text-muted); font-size: 13px; }
.cdm-ed-lien { text-decoration: underline; cursor: pointer; }
.cdm-ed-lien.est-absente { text-decoration-style: dotted; color: var(--text-muted); }
.cdm-ed-image { display: inline-block; position: relative; cursor: pointer; }
.cdm-ed-image img { max-width: min(100%, 320px); border-radius: 6px; display: block; }
.cdm-ed-corps [data-cdm-cache] { opacity: 0.45; text-decoration: line-through; color: var(--text-error, #e0625e); }
.cdm-ed-image[data-cdm-cache] { outline: 2px dashed var(--text-error, #e0625e); outline-offset: 2px; }
.cdm-ed-corps.est-apercu [data-cdm-sorte] { cursor: default; }
.cdm-ed-tete button { display: inline-flex; align-items: center; gap: 6px; }
.cdm-ed-bouton-ico { display: flex; --icon-size: 15px; }

/* carte en îlots : halo derrière chaque groupe */
.cdm-ilot { fill-opacity: 0.06; stroke-opacity: 0.28; stroke-width: 1.5; stroke-dasharray: 3 7; stroke-linecap: round; }
.cdm-world.has-actif .cdm-ilot { fill-opacity: 0.03; stroke-opacity: 0.12; }
/* éditeur : mini-fiche des joueurs posée à plat, et texte composé automatiquement */
.cdm-bulle.est-posee { position: static; float: right; opacity: 1; transform: none; width: 300px; max-height: none; margin: 0 0 16px 24px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
.cdm-ed-apercu-cote::after { content: ''; display: block; clear: both; }
.cdm-ed-auto { max-width: 860px; margin: 0 0 12px 30px; }
.cdm-ed-auto .cdm-ed-synthese { border-left-color: var(--text-faint); font-style: italic; }
/* ordre choisi à la main : repère d'insertion pendant le glisser */
.nav-files-container .cdm-ordre-avant { box-shadow: inset 0 3px 0 var(--interactive-accent) !important; }
.nav-files-container .cdm-ordre-apres { box-shadow: inset 0 -3px 0 var(--interactive-accent) !important; }
/* la fiche de la carte se pose par-dessus : la carte ne change ni de taille ni de zoom */
.cdm-corps { position: relative; }
.cdm-panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 3; box-shadow: -6px 0 20px rgba(0, 0, 0, 0.25); }
@media (max-width: 700px) {
  .cdm-corps { flex-direction: row; }
  .cdm-panel { top: auto; left: 0; width: auto; max-height: 50%; border-left: 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25); }
}
/* mini-fiche compacte : lien cliqué dans le texte d'une note */
.cdm-bulle.est-compacte { width: 360px; max-height: 400px; padding: 10px 12px; font-size: 12px; line-height: 1.4; }
.cdm-c-tete { display: flex; align-items: center; gap: 10px; }
/* illustration en grand à gauche, propriétés et résumé à sa droite */
.cdm-c-milieu { display: flex; align-items: flex-start; gap: 12px; margin-top: 8px; }
.cdm-c-vignette { flex: none; width: 120px; height: 150px; border-radius: 8px; overflow: hidden; }
.cdm-c-vignette img, .cdm-c-vignette canvas { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.cdm-c-vignette.est-cliquable { cursor: zoom-in; }
.cdm-c-vignette.est-cliquable:hover { box-shadow: 0 0 0 2px var(--interactive-accent); }
/* visionneuse : l'image en grand, nette ; un clic passe en taille réelle */
.cdm-visionneuse { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.88); cursor: default; }
.cdm-visionneuse canvas { display: block; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); cursor: zoom-in; }
.cdm-visionneuse.est-reelle { display: block; overflow: auto; }
.cdm-visionneuse.est-reelle img { display: block; max-width: none; margin: 24px auto; cursor: zoom-out; }
.cdm-c-texte { flex: 1; min-width: 0; }
.cdm-c-noms { min-width: 0; }
.est-compacte .cdm-p-titre { font-size: 15px; }
.est-compacte .cdm-p-cat { margin: 0; font-size: 11px; }
.cdm-c-champs { margin-bottom: 6px; }
.cdm-c-champs > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdm-c-cle { color: var(--text-muted); }
.cdm-c-resume { color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.cdm-c-liens { margin-top: 8px; gap: 4px; }
.cdm-c-liens .cdm-chip { padding: 1px 7px; font-size: 11px; cursor: pointer; }
.cdm-c-pied { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--background-modifier-border); color: var(--text-faint); font-size: 10px; }
.cdm-c-ouvrir { padding: 2px 10px; font-size: 11px; height: auto; }
/* fiche compacte : nom du dossier devant ses étiquettes */
.cdm-c-groupe { align-self: center; margin-left: 2px; color: var(--c); font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.cdm-c-liens .cdm-c-groupe:not(:first-child) { margin-left: 6px; }

/* fiche de la carte : liens rangés par dossier */
.cdm-panel .cdm-b-liens { margin-top: 0; padding-top: 0; border-top: 0; }
.cdm-panel .cdm-b-groupe .cdm-chip { cursor: pointer; }

/* carte : la fiche latérale glisse en place, le zoom « Ajuster » reste net */
@media (prefers-reduced-motion: no-preference) {
  .cdm-panel:not([hidden]) { animation: cdm-fiche-entre 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
  .cdm-node { transition: opacity 0.18s, box-shadow 0.18s; }
  .cdm-lien { animation: cdm-trait 0.22s ease-out; }
}
@keyframes cdm-fiche-entre { from { transform: translateX(24px); opacity: 0; } }
@keyframes cdm-trait { from { opacity: 0; } }
/* ---------- sommaire automatique d'un dossier (Obsidian et site) ---------- */
.cdm-sommaire-auto { margin: 28px 0 40px; clear: both; }
.cdm-som-titre {
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--c, var(--interactive-accent));
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cdm-som-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cdm-som-carte {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  border-left: 4px solid var(--c);
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 8%, transparent);
  color: var(--text-normal);
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}
.cdm-som-carte:hover { background: color-mix(in srgb, var(--c) 20%, transparent); transform: translateY(-1px); }
.cdm-som-carte.est-cachee { border-style: dashed; opacity: 0.75; }
.cdm-som-vignette { flex: none; width: 46px; height: 46px; border-radius: 8px; overflow: hidden; }
.cdm-som-vignette img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; margin: 0; }
.cdm-som-texte { min-width: 0; }
.cdm-som-nom { font-weight: 700; line-height: 1.25; }
.cdm-som-apercu { margin-top: 3px; color: var(--text-muted); font-size: 0.85em; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cdm-som-marque { margin-top: 4px; color: var(--text-faint); font-size: 0.75em; font-style: italic; }
.cdm-som-section { margin-top: 22px; padding-left: 14px; border-left: 2px solid color-mix(in srgb, var(--c) 45%, transparent); }
.cdm-som-dossier {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--c);
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
}
.cdm-som-dossier:hover span:first-child { text-decoration: underline; }
.cdm-som-n1 { font-size: 1.3em; }
.cdm-som-n2 { font-size: 1.12em; }
.cdm-som-n3 { font-size: 1em; }
.cdm-som-nb { padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--text-muted); font-size: 11px; font-weight: 600; }
/* dans une note Obsidian : même largeur que le texte, non modifiable */
.cm-sizer > .cdm-sommaire-auto { max-width: var(--file-line-width, 700px); margin-left: auto; margin-right: auto; padding: 0 var(--file-margins, 0); user-select: none; }
.markdown-preview-view > .cdm-sommaire-auto { max-width: var(--file-line-width, 700px); margin-left: auto; margin-right: auto; }
/* sommaire de dossier : collé au texte, sans la grande marge vide laissée par l'éditeur */
.cdm-sommaire-auto { margin: 10px 0 0; padding-bottom: 30vh; }
.cdm-som-titre { margin-bottom: 8px; }
.cdm-som-section { margin-top: 14px; }
.cdm-som-dossier { margin-bottom: 6px; }
/* mode édition : la zone de texte ne s'étire plus sur toute la hauteur de la fenêtre */
.cm-sizer:has(> .cdm-sommaire-auto) :is(.cm-contentContainer, .cm-content) { min-height: 0 !important; padding-bottom: 0 !important; }
.cm-sizer:has(> .cdm-sommaire-auto) { min-height: 0 !important; }
/* mode lecture : même chose pour la marge de fin de page */
.markdown-preview-view:has(> .cdm-sommaire-auto) > .markdown-preview-sizer { min-height: 0 !important; padding-bottom: 0 !important; }
.markdown-preview-view:has(> .cdm-sommaire-auto) > .markdown-preview-sizer > .mod-footer { display: none; }
/* ---------- carte du monde ---------- */
.cdm-monde-vue { padding: 0 !important; overflow: hidden; height: 100%; }
.cdm-monde { display: flex; flex-direction: column; height: 100%; outline: none; }
.cdm-m-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--background-modifier-border); background: var(--background-secondary); font-size: 13px; }
.cdm-m-barre .cdm-btn.is-active { background: var(--interactive-accent); color: var(--text-on-accent, #fff); border-color: var(--interactive-accent); }
.cdm-m-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--background-modifier-border); }
.cdm-m-coche { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text-muted); }
.cdm-m-aide { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.cdm-m-corps { flex: 1; min-height: 0; position: relative; display: flex; }
.cdm-m-canvas { flex: 1; position: relative; overflow: hidden; cursor: grab; background: #101014; touch-action: none; user-select: none; }
.cdm-m-canvas.is-drag { cursor: grabbing; }
.cdm-monde.est-outil .cdm-m-canvas { cursor: crosshair; }
.cdm-m-monde { position: absolute; left: 0; top: 0; transform-origin: 0 0; --k: 1; }
.cdm-m-fond { display: block; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.cdm-m-svg { position: absolute; left: 0; top: 0; overflow: visible; }
.cdm-m-vide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 30px; color: var(--text-muted); text-align: center; }
.cdm-m-voile { fill: #15141b; fill-opacity: 0.55; pointer-events: none; }
.cdm-m-voile.est-opaque { fill-opacity: 1; }
.cdm-m-region { fill-opacity: 0.18; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: pointer; transition: fill-opacity 0.15s; }
.cdm-m-region:hover { fill-opacity: 0.32; }
.cdm-m-route { fill: none; stroke-width: 3.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 7; cursor: pointer; }
.cdm-m-route:hover { stroke-width: 5.5; }
.cdm-m-fragment { fill-opacity: 0.05; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 8 6; cursor: pointer; }
.cdm-m-svg .est-cache { stroke-dasharray: 3 6; opacity: 0.7; }
.cdm-m-svg .est-choisi { stroke-width: 4.5; fill-opacity: 0.3; filter: drop-shadow(0 0 4px #fff); }
.cdm-m-nom { fill: #fff; font-weight: 700; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: rgba(0, 0, 0, 0.75); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; font-size: calc(15px / var(--k)); }
.cdm-m-nom.est-fragment { fill: #cfe9c4; font-style: italic; font-size: calc(12px / var(--k)); }
.cdm-m-ebauche { fill: none; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 5 5; pointer-events: none; }
.cdm-m-point { fill: #fff; stroke: #222; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.cdm-m-point.est-premier { fill: var(--interactive-accent); }
.cdm-m-sommet { fill: #fff; stroke: #222; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: move; }
.cdm-m-point, .cdm-m-sommet { transform-box: fill-box; transform-origin: center; transform: scale(calc(1 / var(--k))); }
.cdm-m-epingles { position: absolute; left: 0; top: 0; }
.cdm-m-epingle {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transform: translate(-50%, -100%) scale(calc(1 / var(--k)));
  transform-origin: 50% 100%;
  cursor: pointer;
  white-space: nowrap;
}
.cdm-m-icone { font-size: 24px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); transition: transform 0.15s; }
.cdm-m-epingle:hover .cdm-m-icone { transform: scale(1.2); }
.cdm-m-etiquette { order: -1; padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--c); background: rgba(20, 19, 27, 0.88); color: #fff; font-size: 12px; font-weight: 600; }
.cdm-m-epingle.est-cache { opacity: 0.6; }
.cdm-m-epingle.est-cache .cdm-m-etiquette { border-style: dashed; }
.cdm-m-epingle.est-choisi .cdm-m-etiquette { background: var(--c); }
.cdm-m-epingle.est-choisi .cdm-m-icone { filter: drop-shadow(0 0 5px #fff); }
.cdm-m-panneau { width: 280px; flex: none; overflow-y: auto; padding: 14px; border-left: 1px solid var(--background-modifier-border); background: var(--background-secondary); font-size: 13px; }
.cdm-m-panneau[hidden] { display: none; }
.cdm-m-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.cdm-m-champ { width: 100%; }
.cdm-m-choix { padding: 2px 6px; border-radius: 6px; border: 1px solid var(--background-modifier-border); background: var(--background-primary); cursor: pointer; font-size: 15px; height: auto; box-shadow: none; }
.cdm-m-choix.is-active { border-color: var(--interactive-accent); box-shadow: 0 0 0 2px var(--interactive-accent); }
.cdm-m-pastille { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: none; }
.cdm-m-pastille.is-active { border-color: var(--text-normal); }
.cdm-m-item { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 6px; cursor: pointer; }
.cdm-m-item:hover { background: var(--background-modifier-hover); }
.cdm-m-item.est-cache .cdm-m-item-nom { color: var(--text-faint); }
.cdm-m-oeil { flex: none; width: 26px; padding: 0; height: 22px; border: 0; background: none; box-shadow: none; cursor: pointer; color: var(--text-muted); }
.cdm-m-item-nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ---------- livre : trombinoscope à feuilleter (Obsidian et site) ---------- */
.cdm-livre {
  --cdm-papier: color-mix(in srgb, var(--background-primary) 90%, #c8a46a);
  --cdm-titres: var(--titres, 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cdm-l-barre { gap: 8px; }
.cdm-l-onglets { display: flex; flex-wrap: wrap; gap: 4px; }
.cdm-livre .cdm-l-onglet {
  height: auto;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  color: var(--text-normal);
  font-size: 12px;
  cursor: pointer;
  box-shadow: none;
}
.cdm-livre .cdm-l-onglet:hover { background: color-mix(in srgb, var(--c) 24%, transparent); }
.cdm-livre .cdm-l-onglet.is-active { background: var(--c); border-color: var(--c); color: #fff; font-weight: 600; }
.cdm-l-bascule { display: inline-flex; }
.cdm-l-bascule .cdm-btn { border-radius: 0; }
.cdm-l-bascule .cdm-btn:first-child { border-radius: 6px 0 0 6px; }
.cdm-l-bascule .cdm-btn:last-child { border-radius: 0 6px 6px 0; }
.cdm-l-bascule .cdm-btn.is-active, .cdm-l-barre .cdm-btn.is-active { background: var(--interactive-accent); border-color: var(--interactive-accent); color: var(--text-on-accent, #fff); }
.cdm-l-scene { flex: 1; min-height: 0; overflow-y: auto; background: var(--background-primary); }
.cdm-l-scene.est-livre {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--background-secondary) 70%, transparent), var(--background-primary) 75%);
}
.cdm-l-vide { padding: 40px 24px; color: var(--text-muted); text-align: center; font-style: italic; }

/* trombinoscope */
.cdm-l-trombi { max-width: 1280px; margin: 0 auto; padding: 18px 24px 60px; }
.cdm-l-chapitre { margin-bottom: 34px; }
.cdm-l-chap-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--c); }
.cdm-l-chap-tete h2 { margin: 0; font-family: var(--cdm-titres); font-size: 1.6em; line-height: 1.2; }
.cdm-l-chap-nb { padding: 1px 9px; border-radius: 999px; background: color-mix(in srgb, var(--c) 24%, transparent); color: var(--text-muted); font-size: 12px; font-weight: 600; }
.cdm-l-chap-ouvrir { margin-left: auto; }
.cdm-l-chap-intro { margin: -2px 0 16px; max-width: 760px; color: var(--text-muted); font-style: italic; line-height: 1.5; }
.cdm-l-sous { margin: 18px 0 10px; color: var(--c); font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.cdm-l-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 18px; }
.cdm-livre .cdm-l-carte {
  display: flex;
  flex-direction: column;
  height: auto;
  padding: 8px 8px 12px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--background-modifier-border));
  border-radius: 12px;
  background: var(--cdm-papier, var(--background-secondary));
  color: var(--text-normal);
  text-align: center;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.cdm-livre .cdm-l-carte:hover { transform: translateY(-4px) rotate(-0.6deg); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3); border-color: var(--c); }
.cdm-l-portrait { position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--c) 18%, var(--background-primary)); }
.cdm-l-portrait img, .cdm-l-portrait canvas { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.cdm-l-initiale { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--c); font-family: var(--cdm-titres); font-size: 64px; font-weight: 700; opacity: 0.8; }
.cdm-l-nom { margin-top: 9px; font-family: var(--cdm-titres); font-size: 16px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.cdm-l-sous-titre { margin-top: 2px; color: var(--text-muted); font-size: 12px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* livre ouvert */
.cdm-l-cadre { flex: 1; min-height: 0; display: flex; align-items: center; gap: 10px; padding: 18px 14px 8px; }
.cdm-livre .cdm-l-fleche {
  flex: none;
  width: 42px;
  height: 64px;
  padding: 0;
  border-radius: 10px;
  font-size: 32px;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: pointer;
}
.cdm-livre .cdm-l-fleche:hover:not(:disabled) { color: var(--text-normal); background: var(--background-modifier-hover); }
.cdm-livre .cdm-l-fleche:disabled { opacity: 0.2; cursor: default; }
.cdm-l-livre {
  position: relative;
  flex: 1;
  height: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  perspective: 2400px;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.35));
}
.cdm-l-livre.est-etroit { grid-template-columns: 1fr; }
.cdm-l-page {
  position: relative;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px 26px 12px;
  background: var(--cdm-papier);
  color: var(--text-normal);
  overflow: hidden;
}
.cdm-l-gauche { border-radius: 12px 3px 3px 12px; background-image: linear-gradient(to left, rgba(0, 0, 0, 0.22), transparent 7%); }
.cdm-l-droite { border-radius: 3px 12px 12px 3px; background-image: linear-gradient(to right, rgba(0, 0, 0, 0.22), transparent 7%); }
.cdm-l-unique { border-radius: 12px; }
.cdm-l-entete { flex: none; margin-bottom: 10px; color: var(--c); font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; text-align: center; opacity: 0.85; }
.cdm-l-folio { flex: none; margin-top: 8px; color: var(--text-faint); font-family: var(--cdm-titres); font-size: 12px; text-align: center; }
.cdm-l-contenu { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.cdm-l-gauche .cdm-l-contenu { overflow: hidden; display: flex; }
.cdm-l-planche { flex: 1; min-height: 0; position: relative; border-radius: 6px; overflow: hidden; }
.cdm-l-planche img, .cdm-l-planche canvas { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.cdm-l-planche.est-cliquable { cursor: zoom-in; }
.cdm-l-planche.est-vide { display: flex; background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px dashed color-mix(in srgb, var(--c) 50%, transparent); }
.cdm-l-planche.est-vide .cdm-l-initiale { font-size: 140px; }
.cdm-l-unique .cdm-l-planche { height: min(70vh, 520px); flex: none; margin-bottom: 14px; }
.cdm-l-titre-chap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.cdm-l-unique .cdm-l-titre-chap { padding: 30px 0 10px; }
.cdm-l-titre-chap-nom { color: var(--c); font-family: var(--cdm-titres); font-size: clamp(32px, 5vw, 56px); font-weight: 700; line-height: 1.1; }
.cdm-l-titre-chap-nb { color: var(--text-muted); font-style: italic; }
.cdm-l-orne { color: var(--c); font-size: 22px; line-height: 1; text-align: center; opacity: 0.8; margin: 14px 0; }
.cdm-l-titre { margin: 2px 0 6px; padding-bottom: 8px; border-bottom: 2px solid var(--c); font-family: var(--cdm-titres); font-size: 2em; line-height: 1.15; }
.cdm-l-cat { margin-bottom: 8px; color: var(--c); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.cdm-l-champs { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 12px 0; padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--c) 9%, transparent); font-size: 0.92em; }
.cdm-l-champs dt { color: var(--text-muted); font-weight: 600; }
.cdm-l-champs dd { margin: 0; overflow-wrap: anywhere; }
.cdm-l-chapeau { margin: 12px 0; padding-left: 12px; border-left: 3px solid var(--c); color: var(--text-muted); font-style: italic; line-height: 1.5; }
.cdm-l-texte { line-height: 1.6; font-size: 0.95em; }
.cdm-l-texte h1, .cdm-l-texte h2, .cdm-l-texte h3, .cdm-l-texte h4 { font-family: var(--cdm-titres); line-height: 1.25; clear: both; }
.cdm-l-texte h1 { font-size: 1.45em; }
.cdm-l-texte h2 { font-size: 1.25em; margin: 1.3em 0 0.4em; }
.cdm-l-texte h3 { font-size: 1.08em; margin: 1.1em 0 0.3em; color: var(--c); }
.cdm-l-texte p { margin: 0 0 0.9em; }
.cdm-l-texte ul, .cdm-l-texte ol { margin: 0 0 0.9em; padding-left: 1.4em; }
.cdm-l-texte blockquote { margin: 0 0 1em; padding: 8px 14px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); border-radius: 0 6px 6px 0; }
.cdm-l-texte table { border-collapse: collapse; width: 100%; font-size: 0.92em; }
.cdm-l-texte th, .cdm-l-texte td { padding: 5px 9px; border: 1px solid var(--background-modifier-border); text-align: left; vertical-align: top; }
.cdm-l-texte .tableau { overflow-x: auto; margin: 0 0 1em; }
.cdm-l-texte .illu { display: block; max-width: 100%; height: auto; margin: 0.4em auto 1em; border-radius: 6px; cursor: zoom-in; }
.cdm-l-texte .illu-droite { float: right; max-width: 45%; margin: 4px 0 10px 16px; }
.cdm-l-texte .illu-gauche { float: left; max-width: 45%; margin: 4px 16px 10px 0; }
.cdm-l-texte a.lien { color: var(--interactive-accent); cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--interactive-accent) 45%, transparent); text-underline-offset: 3px; }
.cdm-l-sec { clear: both; margin: 16px 0 6px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.cdm-l-page .cdm-b-liens { margin-top: 0; padding-top: 0; border-top: 0; }
.cdm-l-page .cdm-b-groupe .cdm-chip { cursor: pointer; }
.cdm-l-sommaire { display: flex; flex-wrap: wrap; gap: 6px; }
.cdm-livre .cdm-l-sommaire-item { height: auto; padding: 4px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--text-normal); font: inherit; font-size: 13px; cursor: pointer; box-shadow: none; }
.cdm-livre .cdm-l-sommaire-item:hover { background: color-mix(in srgb, var(--c) 26%, transparent); }

/* la feuille qui tourne */
.cdm-l-feuille { position: absolute; top: 0; bottom: 0; width: 50%; transform-style: preserve-3d; z-index: 2; pointer-events: none; }
.cdm-l-feuille.vers-gauche { left: 50%; transform-origin: left center; }
.cdm-l-feuille.vers-droite { left: 0; transform-origin: right center; }
.cdm-l-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; }
.cdm-l-face > .cdm-l-page { flex: 1; }
.cdm-l-verso { transform: rotateY(180deg); }

/* ruban des portraits */
.cdm-l-ruban { flex: none; display: flex; gap: 6px; padding: 8px 16px 12px; overflow-x: auto; scrollbar-width: thin; justify-content: safe center; }
.cdm-livre .cdm-l-puce {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 18%, var(--background-primary));
  color: var(--c);
  font-family: var(--cdm-titres);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s, border-color 0.15s;
}
.cdm-livre .cdm-l-puce img, .cdm-l-puce canvas { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.cdm-livre .cdm-l-puce:hover { opacity: 1; transform: translateY(-2px); }
.cdm-livre .cdm-l-puce.est-chapitre { border-radius: 8px; width: 28px; }
.cdm-livre .cdm-l-puce.is-active { opacity: 1; border-color: var(--c); transform: scale(1.15); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }

@media (max-width: 700px) {
  .cdm-l-cadre { padding: 10px 4px 4px; gap: 2px; }
  .cdm-livre .cdm-l-fleche { width: 28px; font-size: 26px; }
  .cdm-l-page { padding: 14px 16px 10px; }
  .cdm-l-trombi { padding: 14px 12px 40px; }
  .cdm-l-grille { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
}
/* Obsidian : la carte et le livre partagent l'onglet */
.cdm-view-zone { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* éditeur joueurs : onglet « Livre » */
.cdm-ed-onglets { margin-right: 6px; }
.cdm-ed-livre.cdm-livre { display: block; flex: 1; min-height: 0; overflow-y: auto; padding: 16px 24px 60px; }
.cdm-ed-livre-bilan { max-width: 1280px; margin: 0 auto 18px; }
.cdm-ed-livre-etat { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.cdm-ed-livre-etat.est-ok { background: color-mix(in srgb, #6cae4f 16%, transparent); border: 1px solid color-mix(in srgb, #6cae4f 50%, transparent); }
.cdm-ed-livre-etat.est-absent { background: color-mix(in srgb, var(--text-error, #e0625e) 14%, transparent); border: 1px solid color-mix(in srgb, var(--text-error, #e0625e) 50%, transparent); }
.cdm-ed-livre-bilan .cdm-ed-aide { margin: 8px 2px 0; }
.cdm-ed-livre .cdm-l-chapitre { max-width: 1280px; margin: 0 auto 30px; }
.cdm-ed-livre-actions { margin-left: auto; display: flex; gap: 6px; }
.cdm-livre .cdm-ed-livre-carte { position: relative; }
.cdm-ed-livre-carte.est-cachee { border-style: dashed; opacity: 0.6; }
.cdm-ed-livre-carte.est-cachee .cdm-l-portrait canvas, .cdm-ed-livre-carte.est-cachee .cdm-l-portrait img { filter: grayscale(1) brightness(0.7); }
.cdm-ed-livre-carte.est-cachee:hover { opacity: 0.9; }
.cdm-ed-livre-oeil {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  padding: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  --icon-color: #fff;
}
.cdm-ed-livre-oeil:hover { background: var(--interactive-accent); }
.cdm-ed-livre-carte.est-cachee .cdm-ed-livre-oeil { background: var(--text-error, #e0625e); }
.cdm-ed-livre-badge {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%) rotate(-4deg);
  padding: 2px 12px;
  border: 2px solid var(--text-error, #e0625e);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* couverture du trombinoscope : cadre aux proportions de la vignette (3:4) */
.cdm-s-cadre.cdm-s-couverture { width: 240px; height: 320px; overflow: hidden; }
.cdm-s-couverture .cdm-b-img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.cdm-s-couverture ~ .cdm-s-zoom { width: 240px; }
.cdm-livre .cdm-l-cadrer {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.cdm-livre .cdm-l-carte:hover .cdm-l-cadrer, .cdm-livre .cdm-l-cadrer:focus-visible { opacity: 1; }
.cdm-livre .cdm-l-cadrer:hover { background: var(--interactive-accent); }
.cdm-ed-livre-cadrer { position: absolute; top: 6px; left: 6px; z-index: 1; padding: 5px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; --icon-color: #fff; }
.cdm-ed-livre-cadrer:hover, .cdm-ed-livre-cadrer.est-faite { background: var(--interactive-accent); }
/* couverture : nom et légende de la vignette */
.cdm-s-textes { display: grid; gap: 8px; margin: 4px 0 12px; }
.cdm-s-texte { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13px; }
.cdm-s-texte input { width: 100%; }

/* ---------- codex : le livre qui contient tout ---------- */
.cdm-codex { height: 100%; }
.cdm-codex .cdm-l-barre {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--background-modifier-border);
  background: var(--background-secondary);
  font-size: 13px;
}
.cdm-l-titre-barre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--cdm-titres); font-size: 16px; font-weight: 700; }
.cdm-l-recherche { position: relative; }
.cdm-l-recherche .cdm-search { width: 210px; }
.cdm-l-resultats {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  width: 280px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
  background: var(--background-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.cdm-livre .cdm-l-res {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: auto;
  padding: 6px 10px;
  border: 0;
  border-left: 3px solid var(--c);
  border-radius: 4px;
  background: none;
  color: var(--text-normal);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}
.cdm-livre .cdm-l-res:hover { background: var(--background-modifier-hover); }
.cdm-l-res-chap { color: var(--c); font-size: 11px; font-weight: 600; }
.cdm-l-res-vide { padding: 8px 10px; color: var(--text-faint); font-style: italic; }
.cdm-codex.est-ferme .cdm-l-fermer { display: none; }
.cdm-codex .cdm-l-scene {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--background-secondary) 70%, transparent), var(--background-primary) 75%);
}
.cdm-codex .cdm-l-cadre { gap: 44px; padding: 26px 14px 8px; }
.cdm-l-reliure { position: relative; flex: 1; height: 100%; max-width: 1180px; margin: 0 auto; display: flex; min-width: 0; }
.cdm-l-reliure > .cdm-l-livre { max-width: none; margin: 0; }

/* couverture : le livre fermé, centré ; en s'ouvrant il glisse pour laisser place à la page de gauche */
.cdm-codex .cdm-l-livre { transition: transform 0.95s cubic-bezier(0.3, 0.1, 0.25, 1); }
.cdm-l-livre.est-ferme { grid-template-columns: 1fr 1fr; transform: translateX(-25%); }
.cdm-l-livre.est-ferme.est-etroit { grid-template-columns: 1fr; transform: none; }
.cdm-l-livre.est-ferme.est-etroit .cdm-l-vide-gauche { display: none; }
.cdm-l-couv {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 0;
  padding: 34px 28px 24px;
  border-radius: 4px 14px 14px 4px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 220, 160, 0.12), transparent 60%),
    linear-gradient(135deg, #5b2f1f, #3b1d13 60%, #2a140d);
  box-shadow: inset 0 0 0 10px rgba(0, 0, 0, 0.12), inset 0 0 0 12px rgba(226, 190, 120, 0.55), inset 14px 0 18px -10px rgba(0, 0, 0, 0.6);
  color: #e8c98a;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cdm-l-livre.est-ferme .cdm-l-couv:hover { transform: translateY(-3px) rotate(-0.4deg); }
.cdm-l-couv-orne { font-size: 30px; opacity: 0.85; }
.cdm-l-couv-titre { font-family: var(--cdm-titres); font-size: clamp(28px, 4vw, 46px); font-weight: 700; line-height: 1.1; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.cdm-l-couv-image { width: min(62%, 260px); aspect-ratio: 3 / 4; border: 2px solid rgba(226, 190, 120, 0.7); border-radius: 8px; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
.cdm-l-couv-image img, .cdm-l-couv-image canvas, .cdm-l-garde-image img, .cdm-l-garde-image canvas { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.cdm-l-couv-sous { font-size: 12px; letter-spacing: 0.4em; text-transform: uppercase; opacity: 0.75; }
.cdm-l-couv-ouvrir { margin-top: 6px; padding: 6px 16px; border: 1px solid rgba(226, 190, 120, 0.6); border-radius: 999px; font-size: 12px; letter-spacing: 0.08em; opacity: 0.9; }
.cdm-l-face > .cdm-l-couv { flex: 1; }
.cdm-l-garde-image { width: min(55%, 220px); aspect-ratio: 3 / 4; margin-top: 14px; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }

/* marque-pages, en haut du livre */
.cdm-l-signets { position: absolute; top: -18px; right: 48px; z-index: 4; display: flex; gap: 8px; }
.cdm-livre .cdm-l-signet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 64px;
  height: auto;
  padding: 10px 4px 16px;
  border: 0;
  border-radius: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--interactive-accent) 70%, #000), var(--interactive-accent));
  color: #fff;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  box-shadow: none;
  transition: padding 0.18s;
}
.cdm-livre .cdm-l-signet[data-type='monde'] { background: linear-gradient(to bottom, #2b7a6d, #3fa796); }
.cdm-livre .cdm-l-signet:hover, .cdm-livre .cdm-l-signet.is-active { padding-bottom: 26px; }
.cdm-l-signet-ico { font-size: 16px; }

/* onglets des chapitres, sur la tranche */
.cdm-l-tranche { position: absolute; top: 28px; bottom: 28px; right: -30px; z-index: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cdm-livre .cdm-l-onglet-tranche {
  flex: 0 1 auto;
  min-height: 36px;
  max-height: 130px;
  width: 30px;
  height: auto;
  padding: 10px 0 10px 4px;
  border: 0;
  border-radius: 0 7px 7px 0;
  background: color-mix(in srgb, var(--c) 75%, #000);
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  writing-mode: vertical-rl;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 6px 0 6px -4px rgba(0, 0, 0, 0.4);
  transition: width 0.15s, background 0.15s;
}
.cdm-livre .cdm-l-onglet-tranche:hover { background: var(--c); }
.cdm-livre .cdm-l-onglet-tranche.is-active { width: 36px; background: var(--c); }
.cdm-l-livre.est-etroit ~ .cdm-l-tranche { display: none; }

/* double page vivante : sommaire et carte du monde */
.cdm-l-livre.est-pleine { grid-template-columns: 1fr; }
.cdm-l-double { border-radius: 12px; background-image: linear-gradient(to right, transparent calc(50% - 14px), rgba(0, 0, 0, 0.16) 50%, transparent calc(50% + 14px)); }
.cdm-l-contenu.cdm-l-plein { display: flex; flex-direction: column; overflow: hidden; }
.cdm-l-carte-hote, .cdm-l-monde-hote { flex: 1; min-height: 0; height: auto !important; border: 1px solid color-mix(in srgb, var(--c) 30%, var(--background-modifier-border)); border-radius: 8px; overflow: hidden; }
.cdm-l-attente { margin: auto; padding: 40px 10px; color: var(--text-faint); font-style: italic; text-align: center; }
.cdm-l-commencer { margin-top: 14px; }

/* fiches cachées aux joueurs (vue du MJ) */
.cdm-l-tampon {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) rotate(-5deg);
  padding: 3px 14px;
  border: 2px solid var(--text-error, #e0625e);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cdm-livre .cdm-l-carte.est-cachee { border-style: dashed; opacity: 0.6; }
.cdm-livre .cdm-l-puce.est-cachee { opacity: 0.3; filter: grayscale(1); }

/* pages modifiables (Obsidian) */
.cdm-l-outils { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
.cdm-l-outils .cdm-btn, .cdm-l-outils button { height: auto; padding: 3px 10px; font-size: 12px; }
.cdm-l-edition-etat { margin-right: auto; color: var(--text-muted); font-size: 12px; font-style: italic; }
.cdm-l-contenu.est-edition { display: flex; flex-direction: column; }
.cdm-l-edition {
  flex: 1;
  width: 100%;
  min-height: 300px;
  padding: 10px 12px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 6px;
  background: var(--background-primary);
  color: var(--text-normal);
  font-family: var(--font-monospace, ui-monospace, Consolas, monospace);
  font-size: 13px;
  line-height: 1.55;
  resize: none;
}
@media (max-width: 700px) {
  .cdm-codex .cdm-l-cadre { gap: 4px; padding-top: 22px; }
  .cdm-l-signets { right: 16px; }
  .cdm-l-recherche .cdm-search { width: 130px; }
  .cdm-l-titre-barre { font-size: 14px; }
}

/* site : le codex prend toute la page */
#app.site-codex { display: flex; flex-direction: column; height: 100%; }

/* ---------- Obsidian : mode livre (le codex en plein écran) et switch Livre / Notes ---------- */
body.cdm-mode-livre .workspace-ribbon.mod-left,
body.cdm-mode-livre .status-bar { display: none !important; }
body.cdm-mode-livre .workspace-split.mod-root .workspace-tab-header-container-inner,
body.cdm-mode-livre .workspace-split.mod-root .workspace-tab-header-new-tab,
body.cdm-mode-livre .workspace-split.mod-root .workspace-tab-header-tab-list,
body.cdm-mode-livre .sidebar-toggle-button { visibility: hidden; }
body.cdm-mode-livre .workspace-leaf.cdm-leaf-codex {
  position: fixed;
  top: var(--cdm-haut, 40px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--background-primary);
}
.workspace-leaf.cdm-leaf-codex .view-header { display: none; }
.workspace-leaf.cdm-leaf-codex .view-content.cdm-codex-vue { padding: 0; overflow: hidden; height: 100%; }
.cdm-bascule-mode {
  position: fixed;
  z-index: 35;
  display: flex;
  padding: 2px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
  background: var(--background-secondary);
  -webkit-app-region: no-drag;
}
.cdm-bascule-mode button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  box-shadow: none;
  cursor: pointer;
  -webkit-app-region: no-drag;
}
.cdm-bascule-mode button:hover { color: var(--text-normal); background: var(--background-modifier-hover); }
.cdm-bascule-mode button.is-active { background: var(--interactive-accent); color: var(--text-on-accent, #fff); }
.cdm-bascule-ico { display: flex; --icon-size: 15px; }
.cdm-bascule-mode.est-compact .cdm-bascule-nom { display: none; }
.cdm-bascule-mode.est-compact button { padding: 0 6px; }

/* codex : le livre ne dépasse jamais sa place, le ruban des portraits reste visible en dessous */
.cdm-codex .cdm-l-cadre { min-height: 0; }
.cdm-codex .cdm-l-reliure { min-height: 0; max-height: 100%; }
.cdm-codex .cdm-l-livre { min-height: 0; max-height: 100%; grid-template-rows: minmax(0, 1fr); }
.cdm-codex .cdm-l-page, .cdm-codex .cdm-l-face > .cdm-l-page { min-height: 0; max-height: 100%; }
.cdm-codex .cdm-l-ruban { flex: none; }

/* index d'un chapitre : les vignettes rapetissent pour que tout le chapitre tienne sur la page */
.cdm-livre .est-index .cdm-l-grille {
  grid-template-columns: repeat(auto-fill, var(--cdm-vignette, 150px));
  gap: calc(var(--cdm-vignette, 150px) / 10);
  justify-content: start;
}
.cdm-livre .est-index.est-serre .cdm-l-carte { padding: 4px 4px 6px; border-radius: 8px; }
.cdm-livre .est-index.est-serre .cdm-l-nom { margin-top: 4px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.cdm-livre .est-index.est-serre .cdm-l-sous-titre, .cdm-livre .est-index.est-serre .cdm-l-cadrer { display: none; }
.cdm-livre .est-index.est-serre .cdm-l-initiale { font-size: 26px; }
.cdm-livre .est-index .cdm-l-texte { font-size: 0.9em; }
.cdm-livre .est-index.est-tasse .cdm-l-texte { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cdm-livre .est-index.est-tasse .cdm-l-texte > * { margin: 0; display: inline; }
.cdm-livre .est-index .cdm-l-sec { margin-top: 8px; }

/* index : l'œil du MJ, un interrupteur montrer / cacher sur chaque vignette */
.cdm-livre .cdm-l-oeil {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: background 0.15s, transform 0.15s;
}
.cdm-livre .cdm-l-oeil.est-ouvert { background: #4f9a3b; border-color: #8fd27a; }
.cdm-livre .cdm-l-oeil.est-ferme { background: #b5433f; border-color: #f0a19e; }
.cdm-livre .cdm-l-oeil:hover { transform: scale(1.12); }
.cdm-livre .est-index.est-serre .cdm-l-oeil { top: 2px; right: 2px; width: 18px; height: 18px; border-width: 1px; }
.cdm-livre .est-index.est-serre .cdm-l-oeil svg { width: 11px; height: 11px; }
.cdm-livre .cdm-l-carte.est-cachee .cdm-l-portrait canvas, .cdm-livre .cdm-l-carte.est-cachee .cdm-l-portrait img { filter: grayscale(1) brightness(0.7); }
.cdm-livre .cdm-l-carte.est-cachee:hover { opacity: 0.9; }

/* fiche : mode éditeur des passages */
.cdm-l-contenu.est-passages .cdm-ed-bloc { max-width: none; }
.cdm-l-passages .cdm-ed-aide { margin-bottom: 10px; }
.cdm-l-passages .cdm-ed-corps { font-size: 0.92em; }

/* ================================================================== */
/* Thème du codex : le registre de Licia                               */
/* cuir noir-violet, parchemin à la bougie, encre brune et rouge, or,  */
/* broche-étoile à la pierre rose, sceaux de cire                      */
/* ================================================================== */
.cdm-codex, .cdm-bulle-codex {
  --cdm-titres: var(--cdm-police-titres, 'Cinzel', 'Palatino Linotype', Georgia, serif);
  --cdm-texte: var(--cdm-police-texte, 'IM Fell English', Georgia, serif);
  --cdm-main: var(--cdm-police-main, 'Pinyon Script', 'Segoe Script', cursive);
  --cdm-elfique: var(--cdm-police-elfique, 'Noto Sans Buginese', 'Leelawadee UI', sans-serif);
  --cdm-encre: #3a2515;
  --cdm-encre-rouge: #932a20;
  --cdm-or: #c9973d;
  --cdm-or-clair: #f0d48a;
  --cdm-corail: #e07a6f;
  --cdm-parchemin: #e8d6b2;
  --cdm-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .40 0 0 0 0 .27 0 0 0 0 .12 0 0 0 .42 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  --cdm-sigil: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'><g fill='none' stroke='%235a3418' stroke-opacity='.11' stroke-width='1.6'><circle cx='200' cy='200' r='182'/><circle cx='200' cy='200' r='166' stroke-dasharray='2 7'/><circle cx='200' cy='200' r='62'/><circle cx='200' cy='200' r='118'/><polygon points='200,38 340,281 60,281'/><polygon points='200,362 60,119 340,119'/><rect x='96' y='96' width='208' height='208' transform='rotate(45 200 200)'/><circle cx='200' cy='18' r='15'/><circle cx='200' cy='382' r='15'/><circle cx='18' cy='200' r='15'/><circle cx='382' cy='200' r='15'/><path d='M200 138 V262 M138 200 H262 M156 156 L244 244 M244 156 L156 244'/></g></svg>");
  --cdm-cercle-rouge: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 160'><g fill='none' stroke='%23932a20' stroke-opacity='.16' stroke-width='1.5'><ellipse cx='110' cy='80' rx='100' ry='62' transform='rotate(-10 110 80)'/><ellipse cx='110' cy='80' rx='90' ry='54' transform='rotate(-10 110 80)'/><path d='M40 70 h12 m6 0 h9 m5 0 h14 M44 92 h10 m5 0 h16 m4 0 h8' stroke-width='2.2'/></g></svg>");
  --cdm-cuir-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='c'><feTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .02 0 0 0 0 .0 0 0 0 0 .03 0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23c)'/></svg>");
  --cdm-cuir-rayures: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='r'><feTurbulence type='fractalNoise' baseFrequency='.02 .9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .85 0 0 0 0 .7 0 0 0 0 .8 0 0 0 .07 0'/></filter><rect width='100%25' height='100%25' filter='url(%23r)'/></svg>");
  --cdm-cuir: radial-gradient(ellipse at 22% 18%, rgba(140, 92, 128, 0.22), transparent 45%), radial-gradient(ellipse at 80% 85%, rgba(120, 70, 100, 0.18), transparent 40%), var(--cdm-cuir-rayures), var(--cdm-cuir-grain), linear-gradient(135deg, #2e1b2b, #1c0f1a 55%, #120910);
}

/* l'atmosphère : une table dans l'ombre, éclairée à la bougie */
.cdm-codex .cdm-l-scene {
  background:
    radial-gradient(ellipse 55% 45% at 50% 42%, rgba(255, 178, 92, 0.15), transparent 70%),
    radial-gradient(ellipse at 50% 50%, #2b1f1d 0%, #120c0c 70%, #080506 100%);
}
.cdm-codex .cdm-l-barre { background: linear-gradient(#1d1218, #130b10); border-bottom: 1px solid #3b2632; color: #e5d2ad; }
.cdm-codex .cdm-l-titre-barre { font-family: var(--cdm-titres); color: var(--cdm-or-clair); letter-spacing: 0.08em; }
.cdm-codex .cdm-l-barre .cdm-btn, .cdm-codex .cdm-l-barre input, .cdm-codex .cdm-l-barre select { background: #24161f; color: #e5d2ad; border: 1px solid #4a3040; box-shadow: none; }
.cdm-codex .cdm-l-barre .cdm-lab { color: #c9b28a; }
.cdm-livre.cdm-codex .cdm-l-fleche { color: rgba(214, 178, 106, 0.7); }
.cdm-livre.cdm-codex .cdm-l-fleche:hover:not(:disabled) { color: var(--cdm-or-clair); background: rgba(214, 178, 106, 0.1); }

/* la couverture : cuir usé, coins de métal, cadre gaufré, broche-étoile */
.cdm-codex .cdm-l-couv {
  gap: 0;
  padding: 26px;
  border-radius: 5px 16px 16px 5px;
  background: var(--cdm-cuir);
  box-shadow:
    inset 16px 0 22px -12px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(255, 220, 245, 0.06),
    inset 0 0 50px rgba(0, 0, 0, 0.65),
    0 22px 50px rgba(0, 0, 0, 0.6);
  color: var(--cdm-or-clair);
}
.cdm-codex .cdm-l-couv::after {
  content: '';
  position: absolute;
  top: calc(50% - 38px);
  right: -2px;
  width: 22px;
  height: 76px;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, #6e4a16, #e8c271 40%, #a87a2c 70%, #5e3d10);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.cdm-l-couv-coin { position: absolute; width: 64px; height: 64px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.cdm-l-couv-coin svg { display: block; width: 100%; height: 100%; }
.cdm-l-couv-coin.est-hg { top: 7px; left: 7px; }
.cdm-l-couv-coin.est-hd { top: 7px; right: 7px; transform: scaleX(-1); }
.cdm-l-couv-coin.est-bg { bottom: 7px; left: 7px; transform: scaleY(-1); }
.cdm-l-couv-coin.est-bd { bottom: 7px; right: 7px; transform: scale(-1, -1); }
.cdm-l-couv-cadre {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px 22px;
  border: 2px solid rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 225, 245, 0.07), 0 0 0 1px rgba(255, 225, 245, 0.05);
}
.cdm-l-couv-cadre::before, .cdm-l-couv-cadre::after { content: ''; position: absolute; border-radius: 4px; pointer-events: none; }
.cdm-l-couv-cadre::before { inset: 8px; border: 1px solid rgba(201, 151, 61, 0.38); }
.cdm-l-couv-cadre::after { inset: 14px; border: 1px dashed rgba(201, 151, 61, 0.2); }
.cdm-codex .cdm-l-couv-titre {
  position: relative;
  font-family: var(--cdm-titres);
  font-size: clamp(26px, 3.3vw, 46px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.1;
  background: linear-gradient(180deg, #fbe6a8, #d4a24a 55%, #8a5f1e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.7));
}
.cdm-l-couv-embleme { width: min(74%, 300px); }
.cdm-l-couv-embleme svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.cdm-l-couv-embleme .cdm-l-couv-image { width: 70%; margin: 0 auto; }
.cdm-l-couv-signature, .cdm-l-garde-signature { font-family: var(--cdm-elfique); color: var(--cdm-corail); font-size: 26px; letter-spacing: 0.35em; text-shadow: 0 0 10px rgba(224, 122, 111, 0.35); }
.cdm-codex .cdm-l-couv-sous { font-family: var(--cdm-titres); font-size: 12px; letter-spacing: 0.4em; color: rgba(240, 212, 138, 0.65); opacity: 1; }
.cdm-codex .cdm-l-couv-ouvrir { margin-top: 12px; border: 0; padding: 0; font-family: var(--cdm-texte); font-style: italic; font-size: 14px; letter-spacing: 0.04em; color: rgba(240, 212, 138, 0.6); }

/* le livre ouvert : les pages posées dans leur reliure de cuir, tranches de papier en dessous */
.cdm-codex .cdm-l-livre:not(.est-ferme) {
  padding: 12px;
  border-radius: 12px;
  background: var(--cdm-cuir);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7), 0 20px 46px rgba(0, 0, 0, 0.6);
}
.cdm-codex .cdm-l-feuille { top: 12px; bottom: 12px; width: calc(50% - 12px); }
.cdm-codex .cdm-l-feuille.vers-droite { left: 12px; }
.cdm-codex .cdm-l-reliure > .cdm-l-livre { position: relative; z-index: 1; }

/* le parchemin, à la lueur d'une bougie */
.cdm-codex .cdm-l-page, .cdm-bulle-codex {
  --text-normal: var(--cdm-encre);
  --text-muted: #6b4e33;
  --text-faint: #8d7253;
  --background-primary: #efe2c4;
  --background-secondary: #e2cfa8;
  --background-modifier-border: rgba(90, 60, 30, 0.3);
  --background-modifier-hover: rgba(90, 60, 30, 0.08);
  --interactive-accent: var(--cdm-encre-rouge);
  --text-on-accent: #fff6e4;
  --text-highlight-bg: #f2c46a;
  color: var(--cdm-encre);
  font-family: var(--cdm-texte);
}
.cdm-codex .cdm-l-page {
  background-color: var(--cdm-parchemin);
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 244, 214, 0.55), transparent 75%),
    radial-gradient(circle at 82% 12%, rgba(150, 105, 50, 0.13), transparent 18%),
    radial-gradient(circle at 12% 88%, rgba(150, 105, 50, 0.12), transparent 22%),
    var(--cdm-grain);
  background-size: auto, auto, auto, 260px 260px;
  background-position: center, center, center, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  box-shadow: inset 0 0 55px rgba(110, 70, 25, 0.35), 0 1px 0 #d4c098, 0 2px 0 #b6a078, 0 3px 0 #d4c098, 0 4px 0 #a08a62, 0 5px 0 #c9b48b;
}
.cdm-codex .cdm-l-gauche {
  border-radius: 6px 2px 2px 6px;
  background-image:
    linear-gradient(to left, rgba(70, 40, 15, 0.38), transparent 8%),
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 244, 214, 0.55), transparent 75%),
    radial-gradient(circle at 15% 10%, rgba(150, 105, 50, 0.12), transparent 18%),
    var(--cdm-grain);
}
.cdm-codex .cdm-l-droite {
  border-radius: 2px 6px 6px 2px;
  background-image:
    linear-gradient(to right, rgba(70, 40, 15, 0.38), transparent 8%),
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 244, 214, 0.55), transparent 75%),
    radial-gradient(circle at 88% 90%, rgba(150, 105, 50, 0.13), transparent 20%),
    var(--cdm-grain);
}
.cdm-codex .cdm-l-double {
  background-image:
    linear-gradient(to right, transparent calc(50% - 16px), rgba(70, 40, 15, 0.32) 50%, transparent calc(50% + 16px)),
    radial-gradient(ellipse 60% 60% at 50% 45%, rgba(255, 244, 214, 0.5), transparent 75%),
    var(--cdm-grain);
  background-size: auto, auto, 260px 260px;
  background-repeat: no-repeat, no-repeat, repeat;
}
.cdm-codex .cdm-l-unique { border-radius: 8px; }

/* l'écriture : en-têtes et folios à l'encre rouge, titres gravés, lettrines à la plume */
.cdm-codex .cdm-l-entete { font-family: var(--cdm-titres); font-size: 10px; letter-spacing: 0.3em; color: color-mix(in srgb, var(--c) 45%, var(--cdm-encre-rouge)); opacity: 1; }
.cdm-codex .cdm-l-folio { font-family: var(--cdm-titres); color: var(--cdm-encre-rouge); font-size: 12px; }
.cdm-codex .cdm-l-folio::before { content: '— '; }
.cdm-codex .cdm-l-folio::after { content: ' —'; }
.cdm-codex .cdm-l-titre { font-family: var(--cdm-titres); font-weight: 700; letter-spacing: 0.03em; color: var(--cdm-encre); border-bottom: 3px double rgba(147, 42, 32, 0.7); }
.cdm-codex .cdm-l-cat, .cdm-codex .cdm-l-sec { font-family: var(--cdm-titres); color: var(--cdm-encre-rouge); letter-spacing: 0.14em; }
.cdm-codex .cdm-l-champs { background: rgba(120, 80, 40, 0.07); border: 1px solid rgba(90, 60, 30, 0.25); border-radius: 3px; }
.cdm-codex .cdm-l-champs dt { font-family: var(--cdm-titres); font-size: 0.74em; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cdm-encre-rouge); align-self: center; }
.cdm-codex .cdm-l-chapeau { border-left: 2px solid rgba(147, 42, 32, 0.6); color: #5a4128; }
.cdm-codex .cdm-l-texte { font-size: 1.02em; line-height: 1.62; }
.cdm-codex .cdm-l-texte > p:first-of-type::first-letter {
  float: left;
  font-family: var(--cdm-main);
  font-size: 3.6em;
  line-height: 0.82;
  padding: 0.06em 0.14em 0 0;
  color: var(--cdm-encre-rouge);
}
.cdm-codex .cdm-l-texte h1, .cdm-codex .cdm-l-texte h2, .cdm-codex .cdm-l-texte h3, .cdm-codex .cdm-l-texte h4 { font-family: var(--cdm-titres); color: var(--cdm-encre); }
.cdm-codex .cdm-l-texte h3 { color: var(--cdm-encre-rouge); }
.cdm-codex .cdm-l-texte blockquote { border-left-color: rgba(147, 42, 32, 0.55); background: rgba(120, 80, 40, 0.07); font-style: italic; }
.cdm-codex .cdm-l-texte a.lien, .cdm-bulle-codex a.lien { color: #7c1f18; text-decoration-color: rgba(124, 31, 24, 0.45); text-decoration-style: dotted; }
.cdm-codex .cdm-l-orne { color: var(--cdm-encre-rouge); opacity: 0.85; }
.cdm-codex .cdm-l-orne::before, .cdm-codex .cdm-l-orne::after { content: '◆'; display: inline-block; margin: 0 12px; font-size: 0.5em; vertical-align: middle; color: var(--cdm-or); }
.cdm-codex .cdm-l-page .cdm-chip { background: color-mix(in srgb, var(--c) 12%, rgba(255, 250, 235, 0.5)); border-color: color-mix(in srgb, var(--c) 50%, #5a3418); color: var(--cdm-encre); font-family: var(--cdm-texte); }
.cdm-codex .cdm-l-page .cdm-b-groupe-nom, .cdm-codex .cdm-l-page .cdm-c-groupe { font-family: var(--cdm-titres); color: color-mix(in srgb, var(--c) 45%, var(--cdm-encre)); }

/* pages de titre : le nom à la plume, sur l'ornement rouge */
.cdm-codex .cdm-l-titre-chap-nom { font-family: var(--cdm-main); font-weight: 400; font-size: clamp(44px, 6vw, 78px); line-height: 1.15; color: color-mix(in srgb, var(--c) 35%, var(--cdm-encre)); }
.cdm-codex .cdm-l-titre-chap-nb { font-family: var(--cdm-texte); font-style: italic; color: #6b4e33; }
.cdm-codex .cdm-l-page-titre .cdm-l-titre-chap-nom { font-family: var(--cdm-titres); font-weight: 700; font-size: clamp(26px, 3vw, 40px); letter-spacing: 0.05em; color: var(--cdm-encre); }
.cdm-l-garde-embleme { width: min(62%, 260px); }
.cdm-l-garde-embleme svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 3px 4px rgba(60, 35, 10, 0.35)); }
.cdm-codex .cdm-l-garde-signature { font-size: 22px; color: #b5524a; text-shadow: none; }

/* les portraits : collés sur la page, sous un filet d'encre */
.cdm-codex .cdm-l-planche {
  padding: 6px;
  border-radius: 2px;
  background: rgba(255, 248, 228, 0.35);
  box-shadow: 0 0 0 1px rgba(70, 45, 20, 0.45), 0 0 0 5px rgba(232, 214, 178, 0.9), 0 0 0 6px rgba(70, 45, 20, 0.35), 0 8px 18px rgba(50, 30, 10, 0.28);
}
.cdm-codex .cdm-l-planche.est-vide { background: rgba(120, 80, 40, 0.06); border: 0; }
.cdm-livre.cdm-codex .cdm-l-carte { background: rgba(255, 250, 235, 0.38); border: 1px solid rgba(90, 60, 30, 0.35); border-radius: 4px; box-shadow: 0 2px 6px rgba(60, 35, 15, 0.18); }
.cdm-livre.cdm-codex .cdm-l-carte:hover { border-color: var(--cdm-encre-rouge); box-shadow: 0 8px 18px rgba(60, 35, 15, 0.3); }
.cdm-codex .cdm-l-carte .cdm-l-nom { font-family: var(--cdm-titres); font-size: 13px; letter-spacing: 0.03em; color: var(--cdm-encre); }
.cdm-codex .cdm-l-carte .cdm-l-sous-titre { font-family: var(--cdm-texte); font-style: italic; }
.cdm-codex .cdm-l-portrait { border-radius: 2px; background: rgba(120, 80, 40, 0.1); }
.cdm-codex .cdm-l-initiale { font-family: var(--cdm-main); font-weight: 400; color: color-mix(in srgb, var(--c) 40%, var(--cdm-encre)); }

/* textes scellés : le sceau de cire de Shevraar */
.cdm-l-sceau { position: absolute; right: 10px; bottom: 8px; z-index: 2; width: 96px; text-align: center; transform: rotate(-9deg); filter: drop-shadow(0 4px 4px rgba(40, 10, 5, 0.45)); pointer-events: auto; }
.cdm-l-sceau svg { display: block; width: 96px; height: 96px; }
.cdm-l-sceau-nom { margin-top: -6px; font-family: var(--cdm-main); font-size: 24px; color: #8e1b1b; text-shadow: 0 1px 0 rgba(255, 240, 210, 0.6); }

/* les rubans : des marque-pages de tissu qui pendent sous le livre */
.cdm-codex .cdm-l-cadre { padding-bottom: 74px; }
.cdm-codex .cdm-l-signets { top: auto; bottom: -70px; right: 15%; gap: 16px; z-index: 0; }
.cdm-livre.cdm-codex .cdm-l-signet {
  width: 30px;
  height: 94px;
  padding: 0 0 16px;
  justify-content: flex-end;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 28%, rgba(255, 255, 255, 0.16) 50%, transparent 72%, rgba(0, 0, 0, 0.3)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 4px),
    #b8514a;
  transition: height 0.2s;
}
.cdm-livre.cdm-codex .cdm-l-signet[data-type='monde'] {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 28%, rgba(255, 255, 255, 0.16) 50%, transparent 72%, rgba(0, 0, 0, 0.3)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 4px),
    #22767a;
}
.cdm-livre.cdm-codex .cdm-l-signet:hover, .cdm-livre.cdm-codex .cdm-l-signet.is-active { height: 108px; padding-bottom: 16px; }
.cdm-codex .cdm-l-signet-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbe6a8, #c9973d 60%, #7a5418);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  font-size: 12px;
}
.cdm-codex .cdm-l-signet-nom { display: none; }

/* onglets de cuir sur la tranche, rivetés d'or, à la couleur du chapitre */
.cdm-livre.cdm-codex .cdm-l-onglet-tranche {
  position: relative;
  background: linear-gradient(90deg, #2c1b27, #1a0f17);
  border-left: 4px solid var(--c);
  color: #e9d3a8;
  font-family: var(--cdm-titres);
  font-size: 10px;
  letter-spacing: 0.12em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 2px 2px 5px rgba(0, 0, 0, 0.55);
}
.cdm-livre.cdm-codex .cdm-l-onglet-tranche { padding-bottom: 18px; }
.cdm-livre.cdm-codex .cdm-l-onglet-tranche::before { content: ''; position: absolute; bottom: 6px; left: calc(50% - 4px); width: 6px; height: 6px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fbe6a8, #a87a2c); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.6); }
.cdm-livre.cdm-codex .cdm-l-onglet-tranche:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 35%, #2c1b27), #1a0f17); }
.cdm-livre.cdm-codex .cdm-l-onglet-tranche.is-active { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, #2c1b27), #2c1b27); color: #fff3d6; }

/* le ruban des portraits */
.cdm-livre.cdm-codex .cdm-l-puce { border-color: rgba(201, 151, 61, 0.45); background: #241620; color: #e0c48a; font-family: var(--cdm-titres); }
.cdm-livre.cdm-codex .cdm-l-puce.is-active { border-color: var(--cdm-or-clair); box-shadow: 0 0 0 2px rgba(240, 212, 138, 0.35), 0 0 12px rgba(240, 190, 110, 0.4); }

/* le sommaire et la carte du monde, dessinés sur le parchemin */
.cdm-codex .cdm-l-carte-hote, .cdm-codex .cdm-l-monde-hote { border-color: rgba(90, 60, 30, 0.35); }
.cdm-codex .cdm-l-carte-hote .cdm-canvas { background-color: rgba(255, 250, 235, 0.22); background-image: radial-gradient(rgba(90, 60, 30, 0.22) 1px, transparent 1px); }
.cdm-codex .cdm-l-carte-hote .cdm-bar { background: rgba(120, 80, 40, 0.08); border-bottom-color: rgba(90, 60, 30, 0.25); font-family: var(--cdm-texte); }
.cdm-codex .cdm-l-carte-hote .cdm-node { font-family: var(--cdm-texte); }
.cdm-codex .cdm-l-carte-hote .cdm-racine { font-family: var(--cdm-titres); }
.cdm-codex .cdm-l-attente { font-family: var(--cdm-main); font-style: normal; font-size: 26px; color: #8d7253; }

/* boutons du conteur, en haut des pages */
.cdm-codex .cdm-l-page .cdm-l-outils .cdm-btn, .cdm-codex .cdm-l-page .cdm-l-outils button {
  background: rgba(255, 250, 235, 0.55);
  border: 1px solid rgba(90, 60, 30, 0.35);
  color: var(--cdm-encre);
  font-family: var(--cdm-titres);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  box-shadow: none;
}
.cdm-codex .cdm-l-page .cdm-l-outils .mod-warning { border-color: var(--cdm-encre-rouge); color: var(--cdm-encre-rouge); }
.cdm-codex .cdm-l-page .cdm-l-outils .mod-cta { background: var(--cdm-encre-rouge); border-color: var(--cdm-encre-rouge); color: #fff6e4; }
.cdm-codex .cdm-l-edition { background: rgba(255, 252, 240, 0.7); color: var(--cdm-encre); border-color: rgba(90, 60, 30, 0.35); }
.cdm-codex .cdm-l-edition-etat { font-family: var(--cdm-texte); }

/* la mini-fiche du codex : un morceau du même parchemin */
.cdm-bulle.cdm-bulle-codex {
  background-color: #ecdcb8;
  background-image: radial-gradient(ellipse at 50% 30%, rgba(255, 244, 214, 0.55), transparent 75%), var(--cdm-grain);
  background-size: auto, 260px 260px;
  border: 1px solid rgba(90, 60, 30, 0.45);
  border-top: 3px solid color-mix(in srgb, var(--c) 60%, var(--cdm-encre-rouge));
  border-radius: 4px;
  box-shadow: inset 0 0 30px rgba(110, 70, 25, 0.25), 0 12px 32px rgba(0, 0, 0, 0.55);
}
.cdm-bulle-codex .cdm-p-titre { font-family: var(--cdm-titres); color: var(--cdm-encre); }
.cdm-bulle-codex .cdm-p-cat { font-family: var(--cdm-titres); letter-spacing: 0.1em; color: var(--cdm-encre-rouge); }
.cdm-bulle-codex .cdm-c-cle { font-family: var(--cdm-titres); font-size: 0.85em; color: var(--cdm-encre-rouge); }
.cdm-bulle-codex .cdm-c-resume { color: #5a4128; }
.cdm-bulle-codex .cdm-chip { color: var(--cdm-encre); background: color-mix(in srgb, var(--c) 12%, rgba(255, 250, 235, 0.5)); }
.cdm-bulle-codex .cdm-c-pied { border-top-color: rgba(90, 60, 30, 0.3); color: #8d7253; }
.cdm-bulle-codex .cdm-c-ouvrir { background: var(--cdm-encre-rouge); color: #fff6e4; border: 0; }
.cdm-bulle-codex .cdm-c-vignette { border-radius: 2px; box-shadow: 0 0 0 1px rgba(70, 45, 20, 0.45), 0 0 0 3px rgba(232, 214, 178, 0.9), 0 0 0 4px rgba(70, 45, 20, 0.3); }

/* ================================================================== */
/* Filigranes : une image fondue dans le papier, sous l'écriture       */
/* ================================================================== */
.cdm-l-page { isolation: isolate; }
.cdm-l-filigrane { position: absolute; z-index: -1; transform: translate(-50%, -50%) rotate(var(--r, 0deg)); pointer-events: none; user-select: none; }
.cdm-l-filigrane img { display: block; width: 100%; height: auto; max-width: none; }
.cdm-l-filigrane.est-fondu { mix-blend-mode: multiply; }
.cdm-l-filigrane.est-encre { mix-blend-mode: multiply; }
.cdm-l-filigrane.est-encre img { filter: grayscale(1) sepia(0.85) saturate(1.5) brightness(0.6) contrast(1.25); }
.cdm-livre .cdm-l-outils .cdm-btn.is-active { border-color: var(--cdm-or, var(--interactive-accent)); box-shadow: inset 0 0 0 1px var(--cdm-or, var(--interactive-accent)); }

/* la fenêtre de réglage se range à droite et laisse voir le livre */
.cdm-filigrane-conteneur { justify-content: flex-end; }
.cdm-filigrane-conteneur .modal-bg { opacity: 0 !important; }
.cdm-filigrane-conteneur { pointer-events: none; }
.cdm-filigrane-modal { pointer-events: auto; width: 340px; max-width: calc(100vw - 32px); max-height: 88vh; margin-right: 16px; overflow-y: auto; }
.cdm-fil-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin: 10px 0 6px; }
.cdm-fil-choix { height: 76px; padding: 4px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--background-modifier-border); border-radius: 6px; background: var(--background-secondary); cursor: pointer; }
.cdm-fil-choix img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cdm-fil-choix.est-aucun { font-size: 12px; color: var(--text-muted); }
.cdm-fil-choix.is-active { border-color: var(--interactive-accent); box-shadow: 0 0 0 2px var(--interactive-accent); }
/* le filigrane en main : cadre, poignées de taille et de rotation */
.cdm-l-filigrane.est-edite { z-index: 6; pointer-events: auto; cursor: move; outline: 1.5px dashed rgba(147, 42, 32, 0.85); outline-offset: 2px; touch-action: none; }
.cdm-l-filigrane.est-edite.est-saisi { outline-style: solid; }
.cdm-fil-poignee { position: absolute; width: 12px; height: 12px; border: 2px solid #932a20; border-radius: 2px; background: #fff8e8; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }
.cdm-fil-poignee.est-hg { top: -8px; left: -8px; cursor: nwse-resize; }
.cdm-fil-poignee.est-hd { top: -8px; right: -8px; cursor: nesw-resize; }
.cdm-fil-poignee.est-bg { bottom: -8px; left: -8px; cursor: nesw-resize; }
.cdm-fil-poignee.est-bd { bottom: -8px; right: -8px; cursor: nwse-resize; }
.cdm-fil-poignee.est-rotation { top: -34px; left: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%; cursor: grab; }
.cdm-fil-tige { position: absolute; top: -22px; left: calc(50% - 0.75px); width: 1.5px; height: 20px; background: #932a20; pointer-events: none; }
.cdm-fil-boutons { display: flex; flex-wrap: wrap; gap: 4px; }
.cdm-fil-boutons button { padding: 4px 10px; font-size: 12px; }
.cdm-fil-boutons button.is-active { background: var(--interactive-accent); color: var(--text-on-accent); }
.cdm-fil-choix.est-ajouter { font-size: 12px; color: var(--text-accent); border-style: dashed; }
.cdm-fil-galerie.est-survolee { outline: 2px dashed var(--interactive-accent); outline-offset: 4px; border-radius: 6px; }
.cdm-fil-lien { margin: 2px 0 8px; padding: 0; border: 0; background: none; box-shadow: none; color: var(--text-accent); font-size: 12px; cursor: pointer; }
.cdm-fil-mode-emploi { margin: 6px 0 2px; font-style: italic; }
/* ================================================================== */
/* Inconnus : écrit, mais indéchiffrable pour les joueurs              */
/* ================================================================== */
.cdm-indechiffrable {
  font-family: var(--cdm-police-elfique, 'Noto Sans Buginese'), 'Leelawadee UI', 'Segoe UI Historic', sans-serif;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: inherit;
  opacity: 0.72;
  filter: blur(0.35px);
  text-shadow: 0 0 2px currentColor;
  user-select: none;
  cursor: help;
  white-space: nowrap;
}
/* ================================================================== */
/* Sceau elfique (plugin « Sceau elfique ») : les passages scellés    */
/* arrivent aux joueurs écrits en elfique ; interrupteurs et atelier   */
/* ================================================================== */
.cdm-elfique {
  font-family: var(--cdm-police-elfique, 'Noto Sans Buginese'), 'Leelawadee UI', 'Segoe UI Historic', sans-serif;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.08em;
  word-spacing: 0.2em;
  cursor: help;
}
h1 .cdm-elfique, h2 .cdm-elfique, h3 .cdm-elfique, h4 .cdm-elfique { letter-spacing: 0.04em; }

/* l'interrupteur : FR ⟷ ᨔ */
button.cdm-sw {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  height: auto; padding: 3px 6px; border: 0; border-radius: 999px;
  background: transparent; box-shadow: none; cursor: pointer;
  color: inherit; font-size: 11px; line-height: 1;
}
button.cdm-sw:hover { background: color-mix(in srgb, #7d4fa8 12%, transparent); }
.cdm-sw-curseur { position: relative; flex: none; width: 28px; height: 16px; border-radius: 999px; background: rgba(128, 128, 128, 0.35); transition: background 0.15s; }
.cdm-sw-curseur::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); transition: transform 0.15s; }
.cdm-sw.est-on .cdm-sw-curseur { background: #7d4fa8; }
.cdm-sw.est-on .cdm-sw-curseur::after { transform: translateX(12px); }
.cdm-sw.est-partiel:not(.est-on) .cdm-sw-curseur { background: linear-gradient(90deg, rgba(128, 128, 128, 0.35) 50%, #a483c4 50%); }
.cdm-sw-texte { font-weight: 600; opacity: 0.45; }
.cdm-sw:not(.est-on) .cdm-sw-texte.est-off, .cdm-sw.est-on .cdm-sw-texte.est-on { opacity: 1; }
.cdm-sw.est-on:not(.est-global) .cdm-sw-texte.est-on { color: #7d4fa8; }
.cdm-codex .cdm-sw.est-on:not(.est-global) .cdm-sw-texte.est-on { color: #5e2f86; }

/* un paragraphe scellé, dans l'éditeur et les passages du livre */
.cdm-ed-bloc .cdm-sw-sceau { margin-top: 1px; opacity: 0.6; }
.cdm-ed-bloc:hover .cdm-sw-sceau, .cdm-ed-bloc.est-scelle .cdm-sw-sceau { opacity: 1; }
.cdm-ed-bloc.est-scelle { box-shadow: inset 3px 0 0 #7d4fa8; background-color: color-mix(in srgb, #7d4fa8 8%, transparent); }
.cdm-ed-scelle { margin-left: 4px; color: #7d4fa8; font-family: var(--cdm-police-elfique, 'Noto Sans Buginese'), sans-serif; }
.cdm-ed-scelle.est-partielle { opacity: 0.55; }
.cdm-sceau-avis { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.cdm-atelier-page-sceau, .cdm-l-page-sceau { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; cursor: pointer; }

/* la marque ᨔ sur la vignette d'une page scellée (trombinoscope du codex, vue MJ) */
.cdm-l-scellee {
  position: absolute; left: 5px; bottom: 5px; z-index: 1;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: #5e2f86; color: #f3e6ff; border: 1px solid rgba(240, 212, 138, 0.8);
  font-family: var(--cdm-police-elfique, 'Noto Sans Buginese'), sans-serif; font-size: 14px; line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.cdm-l-scellee.est-partielle { background: rgba(94, 47, 134, 0.55); }

/* l'atelier : toutes les pages, façon trombinoscope (éditeur joueurs, onglet Livre ; bouton « Sceau » du codex) */
.cdm-atelier-global { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.cdm-atelier-global-nom { font-weight: 600; font-size: 13px; }
.cdm-ed-livre-bilan { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.cdm-ed-livre-bilan > .cdm-ed-aide { flex-basis: 100%; }
.cdm-atelier-pied { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 4px; }
.cdm-atelier-partiel { font-size: 11px; opacity: 0.7; }
.cdm-ed-livre-carte.est-scellee .cdm-l-portrait { box-shadow: 0 0 0 2px #7d4fa8; }
.cdm-atelier-zoom-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.cdm-atelier-zoom-titre { flex: 1; min-width: 160px; font-size: 22px; font-weight: 700; }
.cdm-atelier-voisin { min-width: 34px; }
.cdm-atelier-apercu { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.cdm-atelier-feuille { max-width: 900px; margin: 0 auto; padding: 18px 24px 30px; border-radius: 8px; background: var(--background-secondary); }

/* dans le codex : par-dessus le livre, sur parchemin */
.cdm-codex-vue { position: relative; }
.cdm-atelier-plein {
  position: absolute; inset: 0; z-index: 40; display: flex; padding: 14px;
  background: rgba(8, 5, 6, 0.88); backdrop-filter: blur(3px);
}
.cdm-atelier-corps {
  flex: 1; max-width: 1240px; margin: 0 auto; overflow-y: auto; padding: 16px 26px 60px; border-radius: 6px;
  background: var(--cdm-grain), radial-gradient(ellipse at 50% 30%, #f1e2c2, var(--cdm-parchemin) 60%, #d9c193);
  color: var(--cdm-encre); font-family: var(--cdm-texte);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(120, 80, 40, 0.25);
}
.cdm-atelier-corps button:not(.cdm-sw) { font-family: var(--interface-font, inherit); }
.cdm-atelier-titre { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid rgba(58, 37, 21, 0.25); }
.cdm-atelier-titre-nom { font-family: var(--cdm-titres); font-size: 24px; color: var(--cdm-encre-rouge); letter-spacing: 0.06em; }
.cdm-atelier-titre-sous { flex: 1; font-family: var(--cdm-main); font-size: 20px; opacity: 0.8; }
.cdm-atelier-corps .cdm-l-chap-tete h2, .cdm-atelier-corps .cdm-atelier-zoom-titre { font-family: var(--cdm-titres); color: var(--cdm-encre); }
.cdm-atelier-corps .cdm-ed-aide, .cdm-atelier-corps .cdm-l-chap-nb { color: rgba(58, 37, 21, 0.75); }
.cdm-atelier-corps .cdm-atelier-feuille { background: rgba(255, 250, 238, 0.55); box-shadow: 0 2px 10px rgba(80, 50, 20, 0.2); }
.cdm-atelier-corps .cdm-ed-bloc:hover { background-color: rgba(120, 80, 40, 0.08); }
.cdm-atelier-corps .markdown-rendered { color: var(--cdm-encre); font-family: var(--cdm-texte); }.cdm-atelier-corps .cdm-ed-apercu-cote .cdm-ed-corps :is(h1, h2, h3, h4, h5, h6) { clear: none; }
.cdm-atelier-zoom-tete > button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cdm-atelier-zoom-tete .cdm-ed-bouton-ico { display: inline-flex; }button.cdm-sw.est-bloque { opacity: 0.55; cursor: not-allowed; }
button.cdm-sw.est-bloque:hover { background: transparent; }
.cdm-ed-livre-actions .cdm-atelier-page-sceau { margin-left: 4px; }
/* ruban des pages, rangé par chapitre : un chapitre fermé n'est qu'une puce, ouvert ses fiches suivent */
.cdm-l-ruban { align-items: center; }
.cdm-l-ruban-groupe { position: relative; flex: none; display: flex; align-items: center; gap: 6px; padding: 2px; border-radius: 12px; transition: background 0.15s; }
.cdm-l-ruban-groupe + .cdm-l-ruban-groupe { margin-left: 4px; }
.cdm-l-ruban-fiches { display: none; gap: 6px; align-items: center; }
.cdm-l-ruban-groupe.est-ouvert { background: color-mix(in srgb, var(--c) 14%, transparent); padding: 2px 8px 2px 2px; }
.cdm-l-ruban-groupe.est-ouvert .cdm-l-ruban-fiches { display: flex; animation: cdm-ruban-ouvre 0.18s ease-out; }
@keyframes cdm-ruban-ouvre { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.cdm-l-ruban-groupe.est-ouvert > .cdm-l-puce.est-chapitre { opacity: 1; border-color: var(--c); }
.cdm-l-puce-nb {
  position: absolute; left: 22px; top: -4px; z-index: 1; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
  border-radius: 999px; background: var(--c); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  pointer-events: none; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.cdm-l-ruban-groupe.est-ouvert .cdm-l-puce-nb { display: none; }
.cdm-codex .cdm-l-ruban-groupe.est-ouvert { background: rgba(201, 151, 61, 0.12); box-shadow: inset 0 0 0 1px rgba(201, 151, 61, 0.25); }
.cdm-codex .cdm-l-puce-nb { background: #8a5a1c; color: #f6e3b4; font-family: var(--cdm-titres); }
/* Site des joueurs. Ce fichier est suivi, à l'export, des styles du plugin (carte, mini-fiche). */

:root {
  --sombre: 1;
  --background-primary: #1b1a1f;
  --background-secondary: #232229;
  --background-modifier-border: #3a3842;
  --background-modifier-hover: rgba(255, 255, 255, 0.07);
  --text-normal: #e4e1ea;
  --text-muted: #a9a4b4;
  --text-faint: #736e7e;
  --text-error: #e0625e;
  --interactive-accent: #9a7be0;
  --text-on-accent: #fff;
  --text-highlight-bg: #ffd54a;
  --layer-popover: 40;
  --titres: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --texte: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='sombre']) {
    --sombre: 0;
    --background-primary: #fbf9f4;
    --background-secondary: #f1ede3;
    --background-modifier-border: #d9d2c2;
    --background-modifier-hover: rgba(0, 0, 0, 0.06);
    --text-normal: #2a2630;
    --text-muted: #625b6b;
    --text-faint: #9a93a3;
    --interactive-accent: #7350c4;
  }
}
:root[data-theme='clair'] {
  --sombre: 0;
  --background-primary: #fbf9f4;
  --background-secondary: #f1ede3;
  --background-modifier-border: #d9d2c2;
  --background-modifier-hover: rgba(0, 0, 0, 0.06);
  --text-normal: #2a2630;
  --text-muted: #625b6b;
  --text-faint: #9a93a3;
  --interactive-accent: #7350c4;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--background-primary);
  color: var(--text-normal);
  font-family: var(--texte);
  font-size: 16px;
  line-height: 1.6;
}
button, input, select { font: inherit; color: inherit; }
button, .cdm-btn {
  padding: 4px 12px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 6px;
  background: var(--background-primary);
  cursor: pointer;
}
button:hover { background: var(--background-modifier-hover); }
button.mod-cta { background: var(--interactive-accent); border-color: var(--interactive-accent); color: var(--text-on-accent); }
input[type='search'], select {
  padding: 5px 10px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 6px;
  background: var(--background-primary);
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--interactive-accent); outline-offset: 1px; }

/* ---------- mise en page ---------- */
#app { display: flex; height: 100%; }
.site-cote {
  width: 290px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--background-modifier-border);
  background: var(--background-secondary);
}
.site-principal { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.site-page { flex: 1; min-height: 0; overflow-y: auto; }
.site-zone-carte { flex: 1; min-height: 0; }
.site-barre { position: absolute; top: 10px; left: 10px; z-index: 6; }
.site-barre-titre { display: none; }
.site-barre .site-icone { background: var(--background-secondary); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25); }
.site-zone-carte .cdm-bar { padding-left: 62px; }
@media (min-width: 801px) { .cote-repliee .site-cote { display: none; } }
.site-voile { display: none; }

.site-tete { display: flex; align-items: center; gap: 8px; }
.site-titre {
  flex: 1;
  color: var(--text-normal);
  font-family: var(--titres);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.site-icone { padding: 2px 9px; font-size: 17px; line-height: 1.4; }
.site-carte-btn {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--interactive-accent) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--interactive-accent) 55%, transparent);
  color: var(--text-normal);
  font-weight: 650;
  text-decoration: none;
}
.site-carte-btn:hover { background: color-mix(in srgb, var(--interactive-accent) 36%, transparent); }
.site-recherche { width: 100%; }

/* ---------- arborescence ---------- */
.site-arbre { font-size: 14px; }
.site-dossier.est-racine {
  margin-bottom: 6px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 7%, transparent);
  overflow: hidden;
}
.site-dossier-titre {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--c);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.site-dossier.est-racine > .site-dossier-titre {
  padding: 7px 10px;
  border-left: 4px solid var(--c);
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 20%, transparent);
  color: var(--text-normal);
  font-weight: 650;
}
.site-dossier-titre:hover { background: color-mix(in srgb, var(--c) 32%, transparent) !important; }
.site-chevron { color: var(--c); transition: transform 0.12s; }
.site-dossier.est-replie > .site-dossier-titre .site-chevron { transform: rotate(-90deg); }
.site-dossier.est-replie > .site-enfants { display: none; }
.site-enfants {
  margin: 2px 0 4px 16px;
  padding-left: 6px;
  border-left: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.site-note {
  display: block;
  margin: 1px 4px 1px 0;
  padding: 3px 9px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
}
.site-note:hover { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text-normal); }
.site-note.est-active {
  background: color-mix(in srgb, var(--c) 30%, transparent);
  box-shadow: inset 3px 0 0 var(--c);
  color: var(--text-normal);
  font-weight: 600;
}
.site-note-dossier { display: block; color: var(--text-faint); font-size: 11px; font-weight: 400; }
.site-sec { margin: 10px 0 4px; color: var(--text-faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.site-vide { color: var(--text-faint); font-style: italic; }

/* ---------- note ---------- */
.site-article { max-width: 820px; margin: 0 auto; padding: 58px 32px 80px; }
.site-fil { color: var(--c); font-size: 13px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.site-article h1, .site-article h2, .site-article h3, .site-article h4 {
  font-family: var(--titres);
  line-height: 1.25;
  clear: both;
}
.site-article h1 { margin: 6px 0 18px; padding-bottom: 10px; border-bottom: 2px solid var(--c); font-size: 2.1em; }
.site-corps h1 { margin-top: 1.6em; }
.site-corps > h1:first-child, .site-article > h1 { margin-top: 6px; }
.site-article h2 { margin: 1.7em 0 0.5em; font-size: 1.5em; }
.site-article h3 { margin: 1.4em 0 0.4em; font-size: 1.2em; color: var(--c); }
.site-corps p { margin: 0 0 1em; }
.site-corps ul, .site-corps ol { margin: 0 0 1em; padding-left: 1.5em; }
.site-corps li { margin: 0.2em 0; }
.site-corps li > ul, .site-corps li > ol { margin-bottom: 0.2em; }
.site-corps hr { border: 0; border-top: 1px solid var(--background-modifier-border); margin: 2em 0; clear: both; }
.site-corps blockquote {
  margin: 0 0 1em;
  padding: 10px 16px;
  border-left: 4px solid var(--c);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--c) 9%, transparent);
}
.site-corps blockquote > :last-child { margin-bottom: 0; }
.site-corps code { padding: 1px 5px; border-radius: 4px; background: var(--background-secondary); font-size: 0.9em; }
.site-corps pre { padding: 12px 14px; border-radius: 8px; background: var(--background-secondary); overflow-x: auto; }
.site-corps mark { background: var(--text-highlight-bg); color: #222; padding: 0 2px; border-radius: 2px; }
.tableau { overflow-x: auto; margin: 0 0 1.2em; }
.site-corps table { border-collapse: collapse; width: 100%; font-size: 0.95em; }
.site-corps th, .site-corps td { padding: 7px 12px; border: 1px solid var(--background-modifier-border); text-align: left; vertical-align: top; }
.site-corps th { background: color-mix(in srgb, var(--c) 16%, transparent); font-weight: 650; }
a.lien, .site-corps a {
  color: var(--interactive-accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--interactive-accent) 45%, transparent);
  text-underline-offset: 3px;
}
a.lien:hover, .site-corps a:hover { text-decoration-color: currentColor; }

.illu { display: block; max-width: 100%; height: auto; margin: 0.4em 0 1em; border-radius: 8px; cursor: zoom-in; }
.illu-droite { float: right; clear: right; max-width: 60%; margin: 4px 0 14px 24px; }
.illu-gauche { float: left; clear: left; max-width: 60%; margin: 4px 24px 14px 0; }
.illu-centre { margin-left: auto; margin-right: auto; }
.site-loupe {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
}
.site-loupe img { max-width: 100%; max-height: 100%; border-radius: 6px; }

.site-pied { clear: both; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--background-modifier-border); }
.site-pied .cdm-chip { text-decoration: none; }
.site-voir-carte { display: inline-block; margin-top: 18px; color: var(--text-muted); font-size: 14px; text-decoration: none; }
.site-voir-carte:hover { color: var(--interactive-accent); }

/* ---------- téléphone ---------- */
@media (max-width: 800px) {
  .site-cote {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.18s;
  }
  .menu-ouvert .site-cote { transform: none; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); }
  .menu-ouvert .site-voile { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.5); }
  .site-barre {
    left: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 8px 12px;
    border-bottom: 1px solid var(--background-modifier-border);
    background: var(--background-secondary);
  }
  .site-barre-titre { display: inline; font-family: var(--titres); font-weight: 700; }
  .site-barre .site-icone { box-shadow: none; }
  .site-zone-carte .cdm-bar { padding-left: 12px; }
  .site-article { padding: 20px 16px 60px; }
  .illu-droite, .illu-gauche { float: none; max-width: 100%; margin: 0.4em auto 1em; }
}
/* ---------- porte d'entrée ---------- */
.site-porte {
  width: min(380px, calc(100vw - 32px));
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--background-modifier-border);
  border-top: 4px solid var(--interactive-accent);
  border-radius: 12px;
  background: var(--background-secondary);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.site-porte-titre { font-family: var(--titres); font-size: 26px; font-weight: 700; line-height: 1.2; }
.site-porte-aide { color: var(--text-muted); font-size: 14px; }
.site-porte-champ { padding: 8px 12px; border: 1px solid var(--background-modifier-border); border-radius: 6px; background: var(--background-primary); }
.site-porte button { padding: 8px 12px; font-weight: 650; }
.site-porte-erreur { min-height: 1.4em; color: var(--text-error); font-size: 14px; }
/* mini-fiche : bouton d'ouverture, pratique au doigt */
.site-fiche-ouvrir { display: block; width: 100%; margin-top: 12px; padding: 7px 12px; font-weight: 650; }

/* dossiers qui ont leur note : nom souligné en pointillés, petite flèche pour l'ouvrir */
.site-dossier-nom { flex: 1; min-width: 0; }
.site-dossier-titre.a-une-note .site-dossier-nom { text-decoration: underline dotted; text-underline-offset: 4px; }
.site-dossier-titre.est-active { box-shadow: inset 0 0 0 2px var(--c); }
.site-dossier-ouvrir { flex: none; padding: 0 6px; border-radius: 6px; color: var(--c); font-weight: 700; text-decoration: none; opacity: 0.75; }
.site-dossier-ouvrir:hover { opacity: 1; background: color-mix(in srgb, var(--c) 30%, transparent); }
/* sommaire d'un dossier : liste de son contenu */
.site-index-titre { margin-top: 2em; }
.site-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; clear: both; }
.site-index-item {
  display: block;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-left: 4px solid var(--c);
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 8%, transparent);
  color: var(--text-normal);
  text-decoration: none;
  transition: background-color 0.12s, transform 0.12s;
}
.site-index-item:hover { background: color-mix(in srgb, var(--c) 20%, transparent); transform: translateY(-1px); }
.site-index-nom { font-family: var(--titres); font-size: 1.1em; font-weight: 700; }
.site-index-apercu { margin-top: 4px; color: var(--text-muted); font-size: 0.85em; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* sommaire de dossier : pas d'espace perdu avant la liste */
.site-article .cdm-sommaire-auto { margin-top: 6px; padding-bottom: 0; }
.site-index-titre { margin: 1.2em 0 0.3em; }
.site-corps:empty { display: none; }

/* livre des fiches */
.site-zone-livre { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.site-zone-livre .cdm-bar { padding-left: 62px; }
.site-livre-btn { background: color-mix(in srgb, #c9a96a 22%, transparent); border-color: color-mix(in srgb, #c9a96a 55%, transparent); }
.site-livre-btn:hover { background: color-mix(in srgb, #c9a96a 36%, transparent); }
@media (max-width: 800px) { .site-zone-livre .cdm-bar { padding-left: 12px; } }

/* carte du monde */
.site-zone-monde { flex: 1; min-height: 0; }
.site-monde-btn { background: color-mix(in srgb, #3fa796 22%, transparent); border-color: color-mix(in srgb, #3fa796 55%, transparent); }
.site-monde-btn:hover { background: color-mix(in srgb, #3fa796 36%, transparent); }
.site-zone-monde .cdm-m-barre { padding-left: 62px; }
@media (max-width: 800px) { .site-zone-monde .cdm-m-barre { padding-left: 12px; } }

/* polices du codex */
@font-face { font-family: "Cinzel"; src: url("polices/cinzel.ttf") format("truetype"); font-style: normal; font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("polices/im-fell-english-italic.ttf") format("truetype"); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("polices/im-fell-english.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans Buginese"; src: url("polices/noto-sans-buginese.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Pinyon Script"; src: url("polices/pinyon-script.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
:root { --cdm-police-titres: "Cinzel", 'Palatino Linotype', Georgia, serif; --cdm-police-texte: "IM Fell English", Georgia, 'Times New Roman', serif; --cdm-police-main: "Pinyon Script", 'Segoe Script', 'Brush Script MT', cursive; --cdm-police-elfique: "Noto Sans Buginese", 'Leelawadee UI', 'Noto Sans', sans-serif; }
