/* Terre Sacrée, lecteur vocal V3 : barre compacte, responsive, styles isolés. */
.ts-voice-reader{box-sizing:border-box;width:calc(100% - 1rem);max-width:680px;margin:1.05rem auto 1.65rem;padding:.55rem .8rem .4rem;background:#080808;border:1px solid #4c4c4c;border-radius:11px;color:#eee;font:400 .86rem/1.35 system-ui,-apple-system,"Segoe UI",sans-serif}
.ts-voice-reader *{box-sizing:border-box}
.ts-voice-reader .tsvr-bar{display:flex;align-items:center;gap:.55rem;min-width:0}
.ts-voice-reader .tsvr-title{font-size:.85rem;white-space:nowrap;color:#f3ca78;font-weight:650}
.ts-voice-reader .tsvr-controls{display:flex;flex-wrap:nowrap;align-items:center;gap:.25rem}
.ts-voice-reader button{appearance:none;background:#202020;border:1px solid #505050;border-radius:6px;min-width:33px;min-height:35px;padding:.3rem .42rem;color:#eee;font:inherit;cursor:pointer;touch-action:manipulation}
.ts-voice-reader button[data-tsvr="play"]{background:#75571d;border-color:#ae853a;color:white;font-weight:600;min-width:89px;white-space:nowrap}
.ts-voice-reader button:disabled{opacity:.35;cursor:default}
.ts-voice-reader button:focus-visible,.ts-voice-reader select:focus-visible{outline:2px solid #f3ca78;outline-offset:2px}
.ts-voice-reader .tsvr-status{font-size:.76rem;color:#c7c7c7;white-space:nowrap;margin-left:auto}
.ts-voice-reader .tsvr-settings-button{white-space:nowrap;font-size:.8rem;padding:.3rem .5rem}
.ts-voice-reader .tsvr-progress{height:3px;background:#333;border-radius:3px;overflow:hidden;margin:.45rem 0 0}
.ts-voice-reader .tsvr-progress>div{height:100%;width:0;background:#d8ae56;transition:width .2s ease}
.ts-voice-reader .tsvr-settings[hidden]{display:none!important}
.ts-voice-reader .tsvr-settings{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem .9rem;border-top:1px solid #333;margin-top:.55rem;padding:.7rem 0 .2rem}
.ts-voice-reader .tsvr-settings label{display:flex;align-items:center;gap:.35rem;color:#ddd;font-size:.83rem}
.ts-voice-reader .tsvr-settings select{max-width:min(60vw,285px);font:inherit;background:#181818;border:1px solid #666;border-radius:5px;color:#fff;padding:.38rem}
.ts-voice-reader .tsvr-settings small{width:100%;font-size:.7rem;color:#aaa}
.ts-voice-reading{outline:2px solid rgba(245,207,120,.75);outline-offset:5px;border-radius:3px;scroll-margin-top:7rem}
@media(max-width:650px){
 .ts-voice-reader{padding:.45rem .48rem .35rem;margin:.85rem auto 1.35rem}
 .ts-voice-reader .tsvr-bar{gap:.28rem;flex-wrap:wrap}
 .ts-voice-reader .tsvr-title{display:none}
 .ts-voice-reader .tsvr-controls{flex:1 1 auto;gap:.22rem}
 .ts-voice-reader button{min-width:32px;min-height:40px;padding:.35rem .4rem}
 .ts-voice-reader button[data-tsvr="play"]{min-width:82px}
 .ts-voice-reader .tsvr-status{font-size:.7rem;order:4;flex:1 0 100%;margin:.1rem 0 0;text-align:right}
 .ts-voice-reader .tsvr-settings-button{margin-left:auto;min-height:40px}
 .ts-voice-reader .tsvr-settings-button span{display:none}
}
@media(max-width:370px){.ts-voice-reader .tsvr-controls{gap:.12rem}.ts-voice-reader button{min-width:30px;padding:.28rem}.ts-voice-reader button[data-tsvr="play"]{min-width:76px;font-size:.8rem}}
@media(prefers-reduced-motion:reduce){.ts-voice-reader .tsvr-progress>div{transition:none}}

/* V3 : lecteur moins large, options de volume et suivi du texte */
.ts-voice-reader{max-width:680px!important;margin-left:auto!important;margin-right:auto!important}
.ts-voice-reader .tsvr-settings input[type="range"]{width:100px;accent-color:#d8ae56;cursor:pointer}
.ts-voice-reader .tsvr-settings input[type="checkbox"]{accent-color:#d8ae56}
.ts-voice-reader .tsvr-settings output{font-size:.75rem;min-width:36px;color:#dedede}
.ts-voice-reader .tsvr-follow{white-space:nowrap}
.ts-voice-reading{background-color:rgba(216,174,86,.085);transition:background-color .25s ease}
@media(max-width:700px){.ts-voice-reader{max-width:calc(100% - 12px)!important;width:calc(100% - 12px)}}
@media(max-width:420px){.ts-voice-reader .tsvr-settings label{flex-wrap:wrap}.ts-voice-reader .tsvr-settings input[type="range"]{width:94px}}
@media(prefers-reduced-motion:reduce){.ts-voice-reading{transition:none}}

/* V4.2 — Espacement vertical uniforme du lecteur, ordinateur et mobile. */
.ts-voice-reader {
  margin-top: 30px !important;
  margin-bottom: 30px !important;
}

/* V4.3 — Lecteur toujours accessible pendant la lecture et la pause.
   Position sticky : aucune duplication de boutons, aucune interruption vocale. */
.ts-voice-reader.tsvr-sticky {
  position: sticky !important;
  top: var(--tsvr-sticky-top, 12px) !important;
  z-index: 1500;
  box-shadow: 0 9px 25px rgba(0, 0, 0, .75);
}
@media (max-width: 650px) {
  .ts-voice-reader.tsvr-sticky {
    top: var(--tsvr-sticky-top, 6px) !important;
  }
}

/* V4.4 — Décalage réel sous le header dynamique, sans modifier header.html. */
.ts-voice-reading { scroll-margin-top: var(--tsvr-scroll-offset, 110px) !important; }

/* V4.5 : le decalage sous header et bandeau RSS est calcule par JS. */


/* V4.6 AGI : lecteur flottant ancré à la fenêtre, au-dessus des contextes CSS
   du contenu et du bandeau RSS. La place initiale reste conservée. */
.ts-voice-reader.tsvr-sticky.tsvr-floating {
  position: fixed !important;
  top: var(--tsvr-sticky-top, 180px) !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  width: min(680px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  max-height: calc(100dvh - var(--tsvr-sticky-top, 180px) - 10px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  margin: 0 !important;
  z-index: 2147483000 !important;
  isolation: isolate;
  box-shadow: 0 12px 32px rgba(0,0,0,.9) !important;
}
@media (max-width:650px) {
  .ts-voice-reader.tsvr-sticky.tsvr-floating {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
  }
}

/* V4.7 AGI Biospheric — bandeau RSS et header au z-index maximal.
   Le lecteur flottant reste en bas de la fenetre pour ne jamais se trouver
   derriere le header (Chrome, Edge, ordinateur et mobile). */
.ts-voice-reader.tsvr-sticky.tsvr-floating {
  top: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 2147483646 !important;
  max-height: min(60dvh, calc(100dvh - 24px)) !important;
}
@media (max-width: 650px) {
  .ts-voice-reader.tsvr-sticky.tsvr-floating {
    bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    max-height: min(55dvh, calc(100dvh - 16px)) !important;
  }
}

/* V4.8 AGI — Commandes alignées, taille uniforme, Arrêter en dernier.
   Ne change ni les règles flottantes V4.7 ni le suivi du texte. */
.ts-voice-reader .tsvr-bar {
  column-gap: .45rem;
  row-gap: .4rem;
}
.ts-voice-reader .tsvr-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}
.ts-voice-reader .tsvr-controls > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  padding: 0 9px;
  line-height: 1;
  font-size: 13px;
  vertical-align: middle;
  box-sizing: border-box;
}
.ts-voice-reader .tsvr-controls > button[data-tsvr="play"] {
  min-width: 125px;
  padding: 0 10px;
  white-space: nowrap;
}
.ts-voice-reader .tsvr-controls > button:not([data-tsvr="play"]) {
  width: 36px;
  padding: 0;
}
.ts-voice-reader .tsvr-settings-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  line-height: 1;
}
@media (max-width: 650px) {
  .ts-voice-reader .tsvr-bar {
    gap: 6px;
  }
  .ts-voice-reader .tsvr-controls {
    gap: 5px;
  }
  .ts-voice-reader .tsvr-controls > button {
    min-height: 36px;
    height: 36px;
    font-size: 12px;
  }
  .ts-voice-reader .tsvr-controls > button[data-tsvr="play"] {
    min-width: 112px;
    padding: 0 7px;
  }
  .ts-voice-reader .tsvr-controls > button:not([data-tsvr="play"]) {
    width: 34px;
    min-width: 34px;
  }
  .ts-voice-reader .tsvr-settings-button {
    min-height: 36px;
  }
}
@media (max-width: 370px) {
  .ts-voice-reader .tsvr-controls { gap: 4px; }
  .ts-voice-reader .tsvr-controls > button[data-tsvr="play"] { min-width: 106px; font-size: 11px; }
  .ts-voice-reader .tsvr-controls > button:not([data-tsvr="play"]) { width: 32px; min-width: 32px; }
}
