:root {
  --teal: #00898f; --teal-d: #00737a; --teal-l: #9fd3d5; --menthe: #e6f4f4;
  --encre: #1d2b2b; --texte: #3b4a4a; --doux: #6b7a7a; --ligne: #e3e8e8;
  --fond: #f3f6f6; --carte: #ffffff; --danger: #c0392b; --ok: #2e9e5b;
  --ombre: 0 1px 2px rgba(16,40,40,.06), 0 6px 20px rgba(16,40,40,.06);
  --rayon: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --teal: #19a7ad; --teal-d: #3bbac0; --teal-l: #2f6f72; --menthe: #12302f;
    --encre: #eef4f4; --texte: #c9d4d4; --doux: #8fa0a0; --ligne: #2a3535;
    --fond: #121818; --carte: #1a2222; --ombre: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); min-height: 100vh;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
h2 { font-size: 16px; color: var(--encre); margin: 0; font-weight: 650; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; }
.aide { color: var(--doux); font-size: 13px; margin: 6px 0 0; }
kbd { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--ligne); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; background: var(--carte); }

/* barre du haut */
.barre { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--carte);
  border-bottom: 1px solid var(--ligne); position: sticky; top: 0; z-index: 10; }
.marque { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.marque svg { width: 38px; height: 38px; stroke: none; }
.marque strong { display: block; color: var(--encre); font-size: 17px; letter-spacing: .02em; }
.marque span { display: block; font-size: 12.5px; color: var(--doux); margin-top: -2px; }
.pastille { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ligne); background: var(--fond);
  color: var(--texte); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.pastille i, .statut-modale i { width: 9px; height: 9px; border-radius: 50%; background: #b4bcbc; flex: none; }
.pastille.ok i, .statut-modale i.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(46,158,91,.18); }
.pastille.ok { color: var(--encre); }
.actions { display: flex; gap: 10px; }

/* boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px;
  padding: 10px 16px; font-weight: 600; font-size: 14.5px; cursor: pointer; border: 1px solid transparent;
  text-decoration: none; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; }
.btn.principal { background: var(--teal); color: #fff; }
.btn.principal:hover { background: var(--teal-d); }
.btn.discret { background: var(--carte); color: var(--encre); border-color: var(--ligne); }
.btn.discret:hover { border-color: var(--teal-l); background: var(--menthe); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.petit { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }

/* mise en page */
.grille { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; padding: 20px 24px 32px;
  max-width: 1500px; margin: 0 auto; }
.carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 18px 20px; }
.scene { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.apercu-cadre { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 10px; }
.apercu-titre { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 6px 8px; font-size: 13px;
  color: var(--doux); font-weight: 600; }
.apercu-titre .aide { margin: 0; font-weight: 500; }
.apercu-titre .aide.marche { color: var(--teal); }
#apercu { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: max(260px, calc(100vh - 420px)); border-radius: 10px; }

.pilote { display: flex; align-items: center; gap: 24px; }
.lecture { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--teal); color: #fff; cursor: pointer;
  display: grid; place-items: center; flex: none; box-shadow: 0 6px 18px rgba(0,137,143,.35); transition: transform .12s, background .2s; }
.lecture:hover { transform: scale(1.04); }
.lecture:active { transform: scale(.97); }
.lecture svg { width: 34px; height: 34px; fill: currentColor; stroke: none; }
.lecture .i-stop, .lecture.marche .i-play { display: none; }
.lecture.marche .i-stop { display: block; }
.lecture.marche { background: var(--encre); box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.compteurs { display: flex; gap: 8px; flex: 1; justify-content: space-around; }
.compteurs div { text-align: center; min-width: 80px; }
.compteurs b { display: block; font-size: 34px; line-height: 1.1; color: var(--encre); font-variant-numeric: tabular-nums; font-weight: 650; }
.compteurs span { font-size: 12.5px; color: var(--doux); text-transform: uppercase; letter-spacing: .06em; }

.ligne-titre { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.choix-rapides { display: flex; gap: 6px; }
.choix-rapides button { border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; }
.choix-rapides button:hover { border-color: var(--teal-l); }
.choix-rapides button.actif { background: var(--menthe); border-color: var(--teal); color: var(--teal-d); font-weight: 600; }
.curseur-ligne { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.curseur-ligne output { min-width: 150px; text-align: right; color: var(--encre); font-weight: 600; font-variant-numeric: tabular-nums; }

/* curseurs */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--teal) var(--pc, 50%), var(--ligne) var(--pc, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; margin-top: -8px;
  background: #fff; border: 2px solid var(--teal); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--ligne); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--teal); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--teal); }

/* panneau de réglages */
.reglages { display: flex; flex-direction: column; gap: 14px; }
details.carte { padding: 0; }
details summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 20px; cursor: pointer; }
details summary::-webkit-details-marker { display: none; }
details summary h2::before { content: ""; display: inline-block; width: 7px; height: 7px; border-right: 2px solid var(--doux);
  border-bottom: 2px solid var(--doux); transform: rotate(-45deg); margin: 0 10px 2px 0; transition: transform .2s; }
details[open] summary h2::before { transform: rotate(45deg); }
details > .groupe, details > .ligne-boutons { padding: 0 20px; }
details > :last-child { padding-bottom: 18px; }
.groupe { margin-bottom: 14px; }
.groupe > label { display: block; font-size: 13px; font-weight: 600; color: var(--encre); margin-bottom: 7px; }

.nuancier { display: flex; flex-wrap: wrap; gap: 8px; }
.nuancier button, .nuancier label { width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(0,0,0,.12);
  cursor: pointer; padding: 0; position: relative; }
.nuancier button.actif { outline: 2px solid var(--teal); outline-offset: 2px; }
.nuancier label { display: grid; place-items: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.nuancier label.actif { outline: 2px solid var(--teal); outline-offset: 2px; }
.nuancier label input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.segment { display: flex; background: var(--fond); border: 1px solid var(--ligne); border-radius: 12px; padding: 3px; gap: 3px; }
.segment button { flex: 1; border: 0; background: transparent; color: var(--texte); border-radius: 9px; padding: 7px 8px;
  cursor: pointer; font-size: 14px; display: grid; place-items: center; }
.segment button:hover { color: var(--encre); }
.segment button.actif { background: var(--carte); color: var(--teal-d); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.interrupteur { position: relative; width: 44px; height: 26px; flex: none; cursor: pointer; }
.interrupteur input { opacity: 0; width: 0; height: 0; position: absolute; }
.interrupteur span { position: absolute; inset: 0; border-radius: 999px; background: #c4cccc; transition: background .2s; }
.interrupteur span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.interrupteur input:checked + span { background: var(--teal); }
.interrupteur input:checked + span::after { transform: translateX(18px); }
.interrupteur input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
details.inactif > .groupe, details.inactif > .ligne-boutons { opacity: .45; }

.pas-a-pas { display: flex; align-items: center; gap: 6px; }
.pas-a-pas button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--ligne); background: var(--carte);
  color: var(--encre); font-size: 20px; cursor: pointer; }
.pas-a-pas input { width: 70px; height: 36px; text-align: center; border: 1px solid var(--ligne); border-radius: 10px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--encre); background: var(--carte); }
.pas-a-pas span { color: var(--doux); margin-left: 4px; }
.ligne-boutons { display: flex; align-items: center; gap: 12px; }
.ligne-boutons .aide { margin: 0; }
.ligne-boutons.fin { justify-content: flex-end; margin-top: 18px; }

.confidentialite { display: flex; gap: 10px; font-size: 13px; color: var(--doux); margin: 4px 4px 0; }
.confidentialite svg { flex: none; width: 18px; height: 18px; color: var(--teal); margin-top: 1px; }

/* fenêtres */
dialog { border: 0; padding: 0; border-radius: 20px; background: var(--carte); color: var(--texte);
  box-shadow: 0 24px 70px rgba(0,0,0,.3); width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15,25,25,.45); }
.modale { padding: 26px 26px 22px; position: relative; }
.modale h2 { font-size: 20px; margin-bottom: 4px; }
.modale > label { display: block; font-size: 13px; font-weight: 600; color: var(--encre); margin: 18px 0 7px; }
.fermer { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 26px; color: var(--doux); cursor: pointer; }
.lien { display: flex; gap: 8px; margin-top: 18px; }
.lien input { flex: 1; min-width: 0; border: 1px solid var(--ligne); border-radius: 12px; padding: 10px 12px; font: inherit;
  font-size: 14px; color: var(--encre); background: var(--fond); }
.partages { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.statut-modale { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--encre); color: var(--carte); padding: 11px 18px; border-radius: 12px; font-size: 14px;
  transition: opacity .25s, transform .25s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.vu { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .grille { grid-template-columns: 1fr; padding: 16px; }
  .barre { flex-wrap: wrap; padding: 10px 16px; }
  .pastille { order: 3; width: 100%; justify-content: center; }
}
@media (max-width: 560px) {
  .actions .discret { display: none; }
  .pilote { flex-wrap: wrap; gap: 14px; }
  .compteurs b { font-size: 26px; }
  .curseur-ligne output { min-width: 110px; font-size: 13px; }
}

.signature { font-size: 13px; color: var(--doux); margin: 0 4px; }
.signature a, .modale.texte a { color: var(--teal-d); }
.lien-texte { border: 0; background: none; padding: 0; color: var(--teal-d); text-decoration: underline; cursor: pointer; font-size: inherit; }
.modale.texte { max-height: 80vh; overflow: auto; }
.modale.texte h3 { font-size: 15px; color: var(--encre); margin: 18px 0 4px; }
.modale.texte p, .modale.texte li { font-size: 14.5px; line-height: 1.55; }
.modale.texte ol { padding-left: 20px; margin: 6px 0; }
