/* Disposition « v3 » : le texte d'abord (script de la scène, une scène à la fois), lecteur en dock fixe en bas, thème sombre. */
html:has(body.v3) { background: #14110f; color-scheme: dark; }
body.v3 {
  --bg: #14110f; --card: #1f1a17; --ink: #f3ece2; --muted: #a99f93; --line: #3a332d; --soft: #2d2621; --blue: #8fb4ff; --green: #7fb6a8;
  --accent: #e0795f; --accent-ink: #14110f; --mine: #2a1d19; --now: #f3ece2; --nowbg: transparent; --err: #f09a82;
  background: #14110f; color: var(--ink);
}
body.v3 a { color: #f09a82; }
body.v3 button, body.v3 select, body.v3 input[type=text] { font-family: inherit; }
body.v3 header#top { background: #14110f; border-bottom: 0; }
body.v3 header#top > .bar:first-child { display: none; }                 /* logo : le fil d'Ariane passe dans la barre du haut */
body.v3 .tools { border-top: 0; }

/* -- barre du haut : scène + options + aide ------------------------------------------------ */
body.v3 #tools > .bar:not(.transport) { flex-wrap: nowrap; gap: 8px; padding: 12px 16px 6px; align-items: center; }
body.v3 #playFull, body.v3 #playWithout, body.v3 #recLink { display: none !important; }
/* trois zones : [? + fil d'Ariane] [Scène, centré] [options] */
body.v3 #v3left, body.v3 #v3right { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; }
body.v3 #v3right { justify-content: flex-end; }
body.v3 #v3title { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; color: var(--ink); }
body.v3 #v3title .up { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.v3 #v3title .up a { color: var(--muted); text-decoration: none; }
body.v3 #v3scene { flex: 0 0 auto; height: 44px; padding: 0 18px; border-radius: 22px; border: 1.5px solid #e0795f; background: #241f1b; color: var(--ink);
  font: 600 16px/1 Georgia, "Times New Roman", serif; white-space: nowrap; cursor: pointer; }
body.v3 #v3scene[aria-expanded="true"] { background: #f3ece2; color: #14110f; }
body.v3 #v3scene[hidden] { display: none !important; }
/* liste des scènes : sous la barre du haut */
body.v3 #v3list { margin: 4px 16px 8px; max-height: 55vh; overflow: auto; padding: 6px; border-radius: 16px; background: #241f1b; box-shadow: 0 8px 24px #000a;
  display: flex; flex-direction: column; gap: 2px; }
body.v3 #v3list.hidden { display: none !important; }
body.v3 #v3list button { min-height: 44px; width: 100%; border: 0; border-radius: 10px; padding: 8px 12px; text-align: left; font-size: 15px; font-weight: 600; color: #cfc6ba; background: none; cursor: pointer; }
body.v3 #v3list button.on { background: #f3ece2; color: #14110f; }
body.v3 #v3list button .cnt { font-weight: 400; color: var(--muted); }
body.v3 #v3list button.on .cnt { color: #4a423b; }
body.v3 #crumb { display: contents; }
body.v3 #optBtn, body.v3 #helpBtn { width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 50%; background: #241f1b; border: 0; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex: 0 0 auto; }
body.v3 #optBtn.on { background: #f3ece2; color: #14110f; }
body.v3 .optpanel { background: #1b1613; border-top: 1px solid var(--line); max-height: 55vh; overflow: auto; }
body.v3 .optpanel .bar { padding: 10px 16px; }
body.v3 .optpanel label { color: #cfc6ba; }
body.v3 #helpPanel { margin: 4px 16px 8px; padding: 12px 14px; border-radius: 14px; background: #241f1b; font-size: 14px; line-height: 1.45; max-height: 50vh; overflow: auto; }
body.v3 #helpPanel h3 { margin: 6px 0 4px; font-size: 14px; }
body.v3 #helpPanel p { margin: 0 0 6px; color: #d9d0c4; }
body.v3 #helpPanel.hidden { display: none !important; }

/* -- choix de la version -------------------------------------------------------------------- */
body.v3 #v3modes { display: flex; gap: 4px; margin: 4px 16px 0; padding: 4px; background: #241f1b; border-radius: 14px; }
body.v3 #v3modes button { flex: 1; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
body.v3 #v3modes button.on { background: #f3ece2; color: #14110f; font-weight: 700; }
body.v3 #v3modes button[hidden] { display: none; }

/* -- le script : une scène à la fois ------------------------------------------------------- */
body.v3 .wrap { padding: 14px 20px 340px; max-width: 640px; }
/* (règles de la page de répétition seulement : celle qui contient les scènes) */
body.v3 #app:has(.card.chunk) > :is(h1, .lead, .hint, .notice, .foot), body.v3 #app details.toc,
body.v3 #app .foldbar, body.v3 #app:has(.card.chunk) > p:has(> button), body.v3 .fold { display: none !important; }
body.v3 #app .card.chunk { background: transparent; border: 0; padding: 0; margin: 0; border-radius: 0; }
body.v3 #app .card.chunk.pending, body.v3 #app .card.chunk.head { display: none !important; }
body.v3 #app .card.chunk > .offbtn, body.v3 #app .card.chunk .ver, body.v3 #app .card.chunk > .hint { display: none !important; }

/* -- choix de la pièce / du personnage ----------------------------------------------------- */
body.v3 #app > h1 { font: 600 28px/1.2 Georgia, "Times New Roman", serif; color: var(--ink); margin: 8px 0 6px; }
body.v3 #app > .lead { color: #cfc6ba; font-size: 15px; line-height: 1.5; }
body.v3 #app > .cover { display: block; max-width: 100%; max-height: 220px; margin: 4px auto 14px; border-radius: 16px; }
body.v3 .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
body.v3 a.pick { background: #1f1a17; border: 1.5px solid #3a332d; border-radius: 16px; padding: 14px 16px; min-height: 0; color: var(--ink); }
body.v3 a.pick:hover { border-color: #e0795f; background: #241f1b; }
body.v3 a.pick.last { border-color: #e0795f; background: #2a1d19; }
body.v3 a.pick h2 { font: 600 19px/1.25 Georgia, "Times New Roman", serif; color: #f3ece2; margin: 0 0 6px; }
body.v3 a.pick .meta { color: var(--muted); font-size: 13px; }
body.v3 a.pick .thumb { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
body.v3 .tag { background: #e0795f; color: #14110f; font-family: system-ui, sans-serif; font-weight: 600; }
body.v3 #app .btn { background: #2d2621; color: var(--ink); border: 0; border-radius: 12px; padding: 11px 16px; }
body.v3 #app > .hint, body.v3 #app > .foot { color: var(--muted); font-size: 13px; }
body.v3 #app input[type=text] { background: #241f1b; color: var(--ink); border: 1px solid #3a332d; border-radius: 10px; padding: 7px 10px; }
body.v3 details.txt > summary, body.v3 details.txt .speedbar { display: none !important; }
body.v3 .lines { margin: 0; display: flex; flex-direction: column; gap: 16px; }
body.v3 .l { --sp: #7fb6a8; padding: 2px 0 2px 14px; border-left: 3px solid transparent; border-radius: 0; font: 14px/1.4 Georgia, "Times New Roman", serif; color: #cfc6ba; opacity: .62; background: none; padding-right: 44px; }
body.v3 .l .who { display: block; font: 700 11px/1.3 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--sp); margin-bottom: 3px; }
body.v3 .l.stage { font-style: italic; color: #a99f93; }
body.v3 .l.mine { border: 1.5px dashed #e0795f; border-radius: 16px; background: #2a1d19; padding: 12px 44px 12px 16px; opacity: .92; color: #f3ece2; }
body.v3 .l.mine .who { color: #f09a82; }
body.v3 .l.mine .who::after { content: " · à vous"; }
body.v3 .l.now { opacity: 1; border-left-color: #f3ece2; color: #f3ece2; font-size: 19px; font-weight: 600; line-height: 1.3; background: none; box-shadow: none; }
body.v3 .l.now.mine { border: 1.5px solid #e0795f; border-left-width: 1.5px; box-shadow: 0 0 0 4px #e0795f22; font-size: 18px; background: #2a1d19; }
body.v3 .l[data-n]:hover { outline: 0; }
body.v3 .l .lb { right: 6px; top: 6px; min-width: 32px; height: 32px; background: #2d2621; border: 0; color: var(--ink); border-radius: 50%; opacity: .55; }
body.v3 .l.marked .lb, body.v3 .l.looped .lb { background: #e0795f; color: #14110f; opacity: 1; }
body.v3 .l.looped { outline: 2px dashed #8fb4ff; outline-offset: 2px; }
body.v3 .l.marked { outline: 2px solid #d8b25c; outline-offset: 2px; }

/* -- dock du lecteur (fixe en bas) --------------------------------------------------------- */
body.v3 #transport { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: 640px; margin: 0 auto; border: 0; border-radius: 24px 24px 0 0;
  background: #1f1a17; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* liseré orange : trait fin dégradé (plus vif en haut au centre) + léger halo */
body.v3 #transport { border: 1.5px solid transparent; border-bottom: 0;
  background: linear-gradient(#1f1a17, #1f1a17) padding-box, linear-gradient(90deg, #e0795f44, #f09a82 50%, #e0795f44) border-box;
  box-shadow: 0 -8px 24px #000a, 0 -2px 14px #e0795f2e; }
body.v3 #transport > * { order: 5; }
body.v3 #vHeard { order: 1; flex: 1 1 100%; margin: 0; padding: 10px 14px; border: 0; border-radius: 14px; background: #2a241f; font: italic 17px/1.4 Georgia, "Times New Roman", serif; color: var(--ink); cursor: pointer; }
/* replié : seule la dernière ligne (le haut déborde et est masqué) ; un clic l'agrandit */
body.v3 #vHeard:not(.open):not(.hidden) { box-sizing: border-box; max-height: calc(1.4em + 20px); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
body.v3 #vHeard:not(.open) > * { flex: 0 0 auto; }
body.v3 #vHeard.open { max-height: 40vh; overflow: auto; }
body.v3 #vHeard .lab { font: 700 11px/1 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-style: normal; margin-right: 8px; }
body.v3 #vHeard .miss { color: #f6d98a; background: #5a4514; border-radius: 4px; padding: 0 4px; text-decoration: none; font-style: normal; font-weight: 600; }
body.v3 #vHeard .good { color: #9fd3c4; }
body.v3 #tLine { order: 2; flex: 1 1 100%; min-height: 0; justify-content: flex-start; }
body.v3 #tLine:not(:has(.cue:not(:empty), .chip:not(.hidden), .vstat:not(:empty))) { display: none; }
body.v3 #tTitle { display: none; }
body.v3 .cue { background: #c4372c; border-radius: 10px; }
body.v3 #v3seekrow { order: 3; flex: 1 1 100%; display: flex; align-items: center; gap: 10px; }
body.v3 #tSeek { flex: 1; min-width: 0; accent-color: #f3ece2; height: 6px; }
body.v3 #tTime { color: var(--muted); font-size: 12px; white-space: nowrap; }
/* commandes : ▶ au milieu sur deux rangs ; ⏮ −10 s | +10 s ⏭ au-dessus ; Aide | Vérification (à la largeur de leur texte) en dessous */
body.v3 #v3main { order: 7; flex: 1 1 100%; display: grid; grid-template-columns: auto 1fr auto 1fr auto; column-gap: 6px; row-gap: 4px; align-items: center;
  grid-template-areas: "prev back play fwd next" "help help play ver ver"; }
body.v3 #v3main #tPrev { grid-area: prev; } body.v3 #v3main #tBack { grid-area: back; justify-self: center; }
body.v3 #v3main #tPlay { grid-area: play; } body.v3 #v3main #tFwd { grid-area: fwd; justify-self: center; } body.v3 #v3main #tNext { grid-area: next; }
body.v3 #v3main #tHelp { grid-area: help; justify-self: start; } body.v3 #v3main #tVerify { grid-area: ver; justify-self: end; }
body.v3 #transport #v3main :is(#tPrev, #tBack, #tFwd, #tNext) { height: 40px; }
body.v3 #transport button { border: 0; background: none; color: var(--ink); height: 48px; min-width: 48px; border-radius: 50%; font-size: 13px; font-weight: 700; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
body.v3 #transport #tPlay { width: 68px; height: 68px; background: #f3ece2; color: #14110f; font-size: 0; position: relative; }
body.v3 #transport #tPlay::after { content: "\25B6"; font-size: 26px; padding-left: 4px; }
body.v3 #transport #tPlay[data-s="pause"]::after { content: "\275A\275A"; font-size: 22px; padding-left: 0; letter-spacing: -2px; }
body.v3 #v3main :is(#tHelp, #tVerify) { width: auto; height: 38px !important; border-radius: 12px !important; background: #2d2621 !important; color: var(--ink) !important;
  font-size: 13px !important; font-weight: 600 !important; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px !important; border: 0; white-space: nowrap; }
body.v3 #v3main #tVerify[aria-pressed="true"] { background: #8fb4ff !important; color: #14110f !important; }
body.v3 #v3main #tHelp.hold { background: #8fb4ff !important; color: #14110f !important; }
body.v3 #v3main #tHelp.off { opacity: .45; }
body.v3 #v3main svg { flex: 0 0 auto; }
body.v3 .netbar { position: static; }
body.v3 details.txt { border: 0; margin: 0; padding: 0; }
body.v3 .lines { border: 0; }

/* tout le texte est affiché : le titre de chaque scène sert de séparateur, le choix d'une scène y fait défiler */
body.v3 #app .card.chunk > :is(h2,h3,h4,h5) { display: block; margin: 28px 16px 8px; font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); scroll-margin-top: 80px; }
body.v3 #app .card.chunk > :is(h2,h3,h4,h5) :is(button, .hint) { display: none; }

/* titre de scène : bandeau plein, pour bien séparer les scènes */
body.v3 #app .card.chunk > :is(h2,h3,h4,h5) { margin: 18px 0 7px; padding: 5px 16px; background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-size: 15px; font-weight: 700; letter-spacing: .08em; text-align: center; box-shadow: 0 2px 0 #0006; }
body.v4 #app .card.chunk > :is(h2,h3,h4,h5) { background: var(--amber); color: #1a1208; }
