:root {
  --fond: #0d0d12;
  --carte: #16161e;
  --bord: #26262f;
  --texte: #ececf1;
  --doux: #9a9aa8;
  --accent: #8b7bff;
  --accent2: #c06bff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1d1830 0%, transparent 60%), var(--fond);
  color: var(--texte);
  font: 15px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
header { padding: 22px 24px 8px; max-width: 1400px; margin: 0 auto; }
h1 {
  margin: 0; font-size: 26px; letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
header p { margin: 4px 0 0; color: var(--doux); font-size: 14px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--doux); margin: 0 0 10px; font-weight: 600; }

main { display: grid; gap: 20px; padding: 16px 24px 40px; max-width: 1400px; margin: 0 auto; }
@media (min-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .apercu { position: sticky; top: 16px; }
}
@media (max-width: 899px) {
  main { padding: 12px 12px 40px; }
  header { padding: 16px 14px 4px; }
  .apercu { position: sticky; top: 0; z-index: 5; background: var(--fond); padding: 6px 0; margin: 0 -12px; padding-inline: 12px; }
  .apercu .cadre { --hmax: 42vh; }
}

.cadre {
  --hmax: 72vh; --r: 1.7778;
  position: relative; width: min(100%, calc(var(--hmax) * var(--r))); aspect-ratio: var(--r); margin: 0 auto;
  background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--bord);
  display: flex; align-items: center; justify-content: center;
}
.cadre canvas { width: 100%; height: 100%; display: block; object-fit: contain; }
#vide {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--doux); text-align: center; font-size: 16px; background: repeating-linear-gradient(45deg, #101016 0 14px, #13131a 14px 28px);
}
#vide[hidden] { display: none; }
#vide small { font-size: 13px; opacity: 0.7; margin-top: 4px; }

.lecteur { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.lecteur.inactif { opacity: 0.4; pointer-events: none; }
#lire {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; display: grid; place-items: center;
}
#lire svg { width: 20px; height: 20px; fill: currentColor; }
#lire .i-pause, #lire.pause .i-lire { display: none; }
#lire.pause .i-pause { display: block; }
#position { flex: 1; }
#temps { font-variant-numeric: tabular-nums; color: var(--doux); font-size: 13px; min-width: 84px; text-align: right; }

.panneau { display: flex; flex-direction: column; gap: 12px; }
.bloc, details { background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 14px; }
details { padding: 0; }
summary { padding: 13px 14px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--doux); font-weight: 400; }
details[open] summary::after { content: "–"; }
.champs { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }

.fichiers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.depot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  border: 1.5px dashed #3a3a48; border-radius: 12px; padding: 14px 8px; cursor: pointer; transition: 0.15s; min-width: 0;
}
.depot:hover, .depot.survol { border-color: var(--accent); background: #8b7bff12; }
.depot.pret { border-style: solid; border-color: #4b8f6a; background: #4b8f6a14; }
.depot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.depot svg { width: 26px; height: 26px; color: var(--accent2); }
.depot small { color: var(--doux); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments span {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 10px;
  border: 1px solid var(--bord); cursor: pointer; font-size: 12.5px; color: var(--doux); text-align: center;
}
.segments input:checked + span { border-color: var(--accent); color: var(--texte); background: #8b7bff1c; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); }
.segments i { display: block; border: 2px solid currentColor; border-radius: 3px; }
.f169 { width: 32px; height: 18px; } .f11 { width: 22px; height: 22px; } .f916 { width: 14px; height: 24px; }

.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  border: 1px solid var(--bord); background: #1d1d27; color: var(--texte); padding: 8px 13px; border-radius: 999px;
  cursor: pointer; font: inherit; font-size: 13.5px;
}
.puce:hover { border-color: #4a4a5c; }
.puce.actif { border-color: var(--accent); background: #8b7bff26; }

.champ { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.champ > span { display: flex; justify-content: space-between; color: #cfcfda; }
.champ output { color: var(--doux); font-variant-numeric: tabular-nums; }
.champ.case { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; }
.champ[hidden] { display: none; }
select, input[type=text] {
  background: #0f0f15; color: var(--texte); border: 1px solid var(--bord); border-radius: 9px; padding: 9px 10px; font: inherit; width: 100%;
}
input[type=color] { width: 100%; height: 38px; border: 1px solid var(--bord); border-radius: 9px; background: #0f0f15; padding: 3px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }

.export .ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.discret { color: var(--doux); font-size: 12.5px; margin: 8px 0; }
.principal {
  display: block; width: 100%; text-align: center; text-decoration: none; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font: inherit; font-weight: 600;
  padding: 13px; border-radius: 11px; margin-top: 6px;
}
.principal:disabled { opacity: 0.35; cursor: not-allowed; }
.secondaire { display: block; width: 100%; margin-top: 8px; padding: 11px; border-radius: 11px; border: 1px solid var(--bord); background: transparent; color: var(--texte); font: inherit; cursor: pointer; }
.lien { background: none; border: 0; color: var(--accent2); cursor: pointer; font: inherit; padding: 0; }
#progression { margin-top: 12px; }
.jauge { height: 8px; background: #0f0f15; border-radius: 99px; overflow: hidden; }
#barre { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.2s; }
.ligne-etat { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--doux); margin-top: 6px; }
.message { color: #ffb08a; font-size: 13.5px; margin: 8px 0 0; }
.message:empty { display: none; }
#resultat video { width: 100%; border-radius: 10px; margin-top: 12px; background: #000; max-height: 50vh; }
