/* Daera — annotations, notes et mode modification. Feuille autonome : elle sert aussi
   sur les pages de lore, qui gardent leur propre style (toujours en clair). */

body {
  --an-fond: #f7f7f2; --an-fond-2: #ecede4; --an-encre: #211e19; --an-encre-2: #4a463d; --an-encre-3: #6f695c;
  --an-trait: #c9c8ba; --an-mousse: #434a2e; --an-alerte: #9a4434; --an-ombre: 0 12px 40px rgba(20, 18, 14, .3);
  --an-jaune: rgba(232, 196, 72, .42); --an-jaune-fort: #b98f1c;
  --an-prune: rgba(140, 100, 148, .28); --an-prune-fort: #6f5a70;
  --an-mousse-s: rgba(110, 135, 60, .28); --an-mousse-fort: #5b6440;
  --an-bas: 0px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body:not(.page-lore) {
    --an-fond: #1c2018; --an-fond-2: #262b21; --an-encre: #ebe8dc; --an-encre-2: #cac6b7; --an-encre-3: #9a9585;
    --an-trait: #3a4030; --an-mousse: #c7d1a0; --an-alerte: #e5907b;
    --an-jaune: rgba(214, 180, 72, .34); --an-jaune-fort: #e0c068;
    --an-prune: rgba(190, 160, 195, .3); --an-prune-fort: #c9b0cb;
    --an-mousse-s: rgba(167, 178, 127, .3); --an-mousse-fort: #b9c58f;
  }
}
:root[data-theme="dark"] body:not(.page-lore) {
  --an-fond: #1c2018; --an-fond-2: #262b21; --an-encre: #ebe8dc; --an-encre-2: #cac6b7; --an-encre-3: #9a9585;
  --an-trait: #3a4030; --an-mousse: #c7d1a0; --an-alerte: #e5907b;
  --an-jaune: rgba(214, 180, 72, .34); --an-jaune-fort: #e0c068;
  --an-prune: rgba(190, 160, 195, .3); --an-prune-fort: #c9b0cb;
  --an-mousse-s: rgba(167, 178, 127, .3); --an-mousse-fort: #b9c58f;
}
@media (max-width: 899px) { body { --an-bas: calc(62px + env(safe-area-inset-bottom)); } }

/* ---------------------------------------------------------------- passages annotés */
mark.annot {
  color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
mark.annot-jaune { background: var(--an-jaune); }
mark.annot-prune { background: var(--an-prune); }
mark.annot-mousse { background: var(--an-mousse-s); }
mark.annot mark.annot { padding: 0; }
mark.annot-corrige { text-decoration: line-through; text-decoration-thickness: 1.5px; opacity: .75; }
mark.annot-eclat { outline: 3px solid var(--an-jaune-fort); outline-offset: 2px; }
ins.annot-correction {
  text-decoration: none; margin-left: 4px; padding: 0 3px; border-radius: 3px; cursor: pointer;
  background: var(--an-mousse-s); border-bottom: 2px solid var(--an-mousse-fort); font-style: normal;
}
.annot-bulle {
  display: inline-grid; place-items: center; width: 20px; height: 20px; margin: 0 2px; padding: 0;
  vertical-align: text-top; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: var(--an-prune-fort);
}
.annot-bulle.annot-jaune { background: var(--an-jaune-fort); }
.annot-bulle.annot-mousse { background: var(--an-mousse-fort); }
.annot-bulle svg { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- notes */
.annot-note {
  margin: 14px 0; padding: 12px 14px; border-radius: 10px; font-family: "Spectral", Georgia, serif; font-size: 15.5px; line-height: 1.55;
  background: var(--an-fond-2); border-left: 3px solid var(--an-prune-fort); color: var(--an-encre);
}
.annot-note-tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.annot-note-tete span { font-size: 11.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--an-prune-fort); }
.annot-note-texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.annot-correction-texte { border-left: 3px solid var(--an-mousse-fort); padding-left: 10px; }
.annot-vide { margin: 0; color: var(--an-encre-3); font-style: italic; font-size: 14.5px; }
.annot-perdues { margin-top: 10px; font-size: 14px; color: var(--an-encre-2); }
.annot-perdues .annot-lien { display: block; text-align: left; margin-top: 4px; }
.page-lore [data-note] { max-width: 760px; margin: 0 auto; padding: 0 40px; }
@media (max-width: 600px) { .page-lore [data-note] { padding: 0 20px; } }
.annot-invite { margin-top: 14px; }
.annot-indicateur { display: inline-flex; align-items: center; color: var(--an-prune-fort); }
.annot-indicateur svg { width: 15px; height: 15px; }
.annot-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- boutons */
.annot-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 7px 15px;
  border-radius: 999px; border: 1px solid var(--an-trait); background: var(--an-fond); color: var(--an-encre);
  font: 500 15px/1.2 "Spectral", Georgia, serif; cursor: pointer; text-decoration: none;
}
.annot-btn:hover { border-color: var(--an-mousse-fort); }
.annot-btn[disabled] { opacity: .5; cursor: not-allowed; }
.annot-btn-petit { min-height: 34px; padding: 4px 12px; font-size: 14px; }
.annot-btn-plein { background: var(--an-mousse); border-color: var(--an-mousse); color: var(--an-fond); }
.annot-btn-alerte { border-color: var(--an-alerte); color: var(--an-alerte); }
.annot-lien { background: none; border: 0; padding: 0; color: var(--an-mousse); text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------------------------------------------------------------- barres du bas */
.annot-barre, .annot-selection {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70; width: min(680px, calc(100vw - 16px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px 8px 14px;
  background: var(--an-fond); color: var(--an-encre); border: 1px solid var(--an-trait); border-radius: 16px; box-shadow: var(--an-ombre);
  font-family: "Spectral", Georgia, serif; font-size: 14.5px;
}
.annot-barre { bottom: calc(var(--an-bas) + 8px); border-left: 4px solid var(--an-prune-fort); }
.annot-barre-texte { flex: 1 1 180px; }
.annot-selection { bottom: calc(var(--an-bas) + 72px); }
.annot-sel-titre { font-weight: 600; margin-right: 2px; }
.annot-couleur { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--an-trait); cursor: pointer; padding: 0; }
.annot-couleur.annot-jaune { background: var(--an-jaune); border-color: var(--an-jaune-fort); }
.annot-couleur.annot-prune { background: var(--an-prune); border-color: var(--an-prune-fort); }
.annot-couleur.annot-mousse { background: var(--an-mousse-s); border-color: var(--an-mousse-fort); }
body.annot-edition::after { content: ""; display: block; height: 150px; }
body.annot-edition dialog .detail-int { padding-bottom: 170px; }
@media (max-width: 520px) {
  .annot-barre, .annot-selection { gap: 6px; padding: 6px 8px 6px 12px; font-size: 13.5px; }
  .annot-barre-prefixe, .annot-sel-titre { display: none; }
  .annot-barre .annot-btn, .annot-selection .annot-btn { min-height: 34px; padding: 4px 11px; font-size: 13.5px; }
  .annot-couleur { width: 30px; height: 30px; }
  .annot-selection { bottom: calc(var(--an-bas) + 62px); }
}
.bouton-edition[aria-pressed="true"] { background: var(--an-prune-fort) !important; color: #fff !important; border-color: var(--an-prune-fort) !important; }

/* ---------------------------------------------------------------- fenêtres */
dialog.annot-dialogue {
  width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 16px;
  background: var(--an-fond); color: var(--an-encre); box-shadow: var(--an-ombre);
  font-family: "Spectral", Georgia, serif; font-size: 16px; line-height: 1.55;
}
dialog.annot-dialogue::backdrop { background: rgba(10, 12, 8, .55); }
.annot-dialogue form { padding: 20px 20px 16px; }
.annot-dialogue h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 1.7rem; line-height: 1.15; margin: 0 0 12px; }
.annot-dialogue p { margin: 0 0 10px; }
.annot-dialogue-boutons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.annot-dialogue-alerte { border-top: 4px solid var(--an-alerte) !important; }
.annot-champ { display: grid; gap: 4px; margin: 12px 0 0; font-size: 14px; font-weight: 600; color: var(--an-encre-2); }
.annot-champ input, .annot-champ textarea, .annot-champ select {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--an-trait); background: var(--an-fond-2);
  color: var(--an-encre); font: 400 16px/1.5 "Spectral", Georgia, serif; resize: vertical;
}
.annot-champ select { min-height: 42px; }
.annot-case { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 14.5px; }
.annot-radios { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.annot-radio { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; cursor: pointer; }
.annot-pastille { display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: -1px; }
.annot-pastille.annot-jaune { background: var(--an-jaune-fort); }
.annot-pastille.annot-prune { background: var(--an-prune-fort); }
.annot-pastille.annot-mousse { background: var(--an-mousse-fort); }
.annot-extrait {
  display: block; width: 100%; text-align: left; margin: 0 0 8px; padding: 9px 12px; border: 0; border-radius: 8px;
  font: italic 15.5px/1.5 "Spectral", Georgia, serif; color: var(--an-encre); cursor: pointer;
}
.annot-extrait.annot-jaune { background: var(--an-jaune); }
.annot-extrait.annot-prune { background: var(--an-prune); }
.annot-extrait.annot-mousse { background: var(--an-mousse-s); }
.annot-discret { color: var(--an-encre-3); font-size: 14px; }
.annot-erreur { color: var(--an-alerte); font-weight: 600; }
.annot-ok { color: var(--an-mousse-fort); }
.annot-liste-changements { margin: 0; padding-left: 1.1em; max-height: 45vh; overflow: auto; font-size: 15px; }
.annot-liste-changements li { margin: 5px 0; }

.annot-toast {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%) translateY(-10px); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
  background: var(--an-encre); color: var(--an-fond); padding: 10px 16px; border-radius: 999px; font: 14.5px "Spectral", Georgia, serif; text-align: center;
}
.annot-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------- page Notes */
.annot-groupe { font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--an-mousse); margin: 28px 0 10px; }
.annot-carte {
  padding: 14px 16px; margin-bottom: 12px; border-radius: 14px; background: var(--an-fond); border: 1px solid var(--an-trait);
}
.annot-carte h3 { font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.4rem; margin: 0 0 8px; }
.annot-items { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.annot-item-commentaire { white-space: pre-wrap; margin: 2px 0 2px 12px; }
.annot-item-correction { margin: 2px 0 2px 12px; }
.annot-item-correction span { font-weight: 600; color: var(--an-mousse-fort); }
.annot-historique { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.annot-historique li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px; background: var(--an-fond); border: 1px solid var(--an-trait); font-size: 14.5px; }

@media print {
  .annot-barre, .annot-selection, .annot-toast, .annot-bulle, .bouton-edition, [data-annot-action] { display: none !important; }
  mark.annot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
