:root {
  --bg: #0b0e12;
  --panel: #11161c;
  --panel-2: #151a21;
  --panel-3: #0d1116;
  --line: #2a3038;
  --line-soft: #20262d;
  --text: #d5dbe7;
  --muted: #7e8798;
  --dim: #4f596c;
  --accent: #ff7548;
  --accent-2: #ff9a69;
  --blue: #3496e6;
  --green: #49c67a;
  --danger: #ff5a5f;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at 50% 10%, #15191f 0, var(--bg) 45%, #07090c 100%);
  color: var(--text);
  font-family: var(--ui);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none; /* Pour Safari */
}
input, textarea { 
  user-select: auto;
  -webkit-user-select: auto;
}
button, input { font: inherit; }
button { color: inherit; }

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(560px, 1fr) 302px;
  grid-template-rows: 58px minmax(330px, 1fr) 330px;
  background: #090c10;
}
/* Rendre la grille animable */
.app {
  transition: grid-template-columns 0.3s cubic-bezier(0.2, 0, 0, 1);
}

/* État fermé : on écrase la colonne de droite à 0px */
.app.inspector-closed {
  grid-template-columns: 292px 1fr 0px !important;
}

.app.inspector-closed .inspector-panel {
  border-left: none; /* Retire la bordure pour ne pas avoir de ligne résiduelle */
}

/* Empêche le texte de sauter à la ligne quand le panneau se réduit */
.inspector-panel {
  overflow: hidden;
  white-space: nowrap;
}

/* Style du bouton "Inspector" quand le panneau est ouvert (actif) */
.toolbar-button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}
.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: #101419;
  position: relative;
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border-right: 1px solid var(--line);
}
.brand-mark {
  width: 27px;
  height: 27px;
  border: 6px solid #63b9ff;;
  transform: rotate(45deg);
  display: inline-block;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-family: var(--mono); font-size: 17px; letter-spacing: 0.08em; }
.brand-copy span { margin-top: 7px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.15em; }

.transport {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.time-readout {
  height: 32px;
  min-width: 222px;
  border: 1px solid #303741;
  background: #0b0f14;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.11em;
}
.time-readout output {
  color: #f0f4fb;
  font-size: 15px;
  letter-spacing: 0.16em;
}
.dot, .bullet {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #63b9ff;;
  box-shadow: 0 0 13px rgba(255, 117, 72, 0.55);
}
.icon-button, .play-button, .toolbar-button, .mini-button, .tool, .danger-button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.icon-button:hover, .play-button:hover, .toolbar-button:hover, .mini-button:hover, .tool:hover {
  border-color: #63b9ff;;
}
.icon-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
.play-button {
  width: 48px;
  height: 38px;
  background: #63b9ff;
  border-color: #6380ff;
  color: #0c0e12;
  font-weight: 800;
}
.play-button.playing { background: #63b9ff; }
.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-right: 14px;
}
.toolbar-button {
  height: 37px;
  min-width: 94px;
  padding: 0 13px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #141920;
}
.toolbar-button.accent {
  color: #110d0b;
  background: #63b9ff;;
  border-color: #63b9ff;;
}

.panel {
  background: var(--panel);
  border-color: var(--line);
}

.delete-media-action {
  position: absolute;
  /* On le place au dessus de la drop-zone (96px) + un petit décalage */
  bottom: 104px; 
  right: 12px;
  
  height: 32px;
  padding: 0 12px;
  background: rgba(255, 90, 95, 0.15);
  border: 1px solid rgba(255, 90, 95, 0.4);
  color: #ffc6c7;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  z-index: 10;
}

.delete-media-action:hover {
  background: rgba(255, 90, 95, 0.3);
  border-color: #ff5a5f;
  transform: translateY(-1px);
}

.delete-media-action:active {
  transform: translateY(0);
}

.delete-media-action .icon {
  font-size: 14px;
}

.media-panel {
  grid-column: 1;
  grid-row: 2 / 4;
  display: grid;
  grid-template-rows: 45px 43px 42px 1fr 96px;
  border-right: 1px solid var(--line);
  min-height: 0;
  position: relative;
}
.inspector-panel {
  grid-column: 3;
  grid-row: 2 / 4;
  border-left: 1px solid var(--line);
  min-height: 0;
}
.panel-title {
  height: 45px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: .2em;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  color: #eef3fa;
}
.panel-title .mini-button { margin-left: auto; }
.mini-button {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
}
.search-row { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.search-row input {
  width: 100%;
  height: 28px;
  border: 1px solid transparent;
  background: #0c1116;
  color: var(--text);
  outline: none;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 11px;
}
.search-row input:focus { border-color: #63b9ff;; }
.tabs {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  height: 42px;
  border: 0;
  background: transparent;
  color: #7f8797;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .15em;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab.active { color: #f5f8fd; border-bottom-color: #63b9ff;; }
.media-list {
  overflow: auto;
  padding: 10px 8px 8px;
  min-height: 0;
}
.media-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  min-height: 64px;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #222933;
  background: #0e1319;
  cursor: grab;
  user-select: none;
}
.media-card:active { cursor: grabbing; }
.media-card.selected { border-color: #63b9ff;; box-shadow: 0 0 0 1px rgba(255,117,72,.18) inset; }
.thumb {
  width: 76px;
  height: 48px;
  object-fit: cover;
  border: 1px solid #303846;
  background: #07090c;
}
.audio-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: -.15em;
  background: repeating-linear-gradient(90deg, rgba(73,198,122,.14) 0 3px, rgba(73,198,122,.04) 3px 7px);
}
.media-meta { min-width: 0; }
.media-meta strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  color: #edf3fb;
}
.media-meta span, .media-meta small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.drop-zone {
  margin: 8px;
  border: 1px dashed #3a4350;
  color: #8a93a4;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  gap: 4px;
}
.drop-zone.drag-over { border-color: #63b9ff;; color: #f8d4c7; background: rgba(255,117,72,.06); }
.drop-icon { font-size: 22px; color: var(--dim); }

/* Modifier le bloc .program-panel existant */
.program-panel {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;   /* CRUCIAL : permet au grid-item de rétrécir */
  min-height: 0;  /* Idem pour la hauteur */
  display: flex;  /* On passe en flex pour un meilleur contrôle du centrage */
  flex-direction: column;
}
/* Remplacer le bloc .viewer-shell existant par celui-ci */
.viewer-shell {
  position: relative;
  flex: 1;       /* Prend tout l'espace vertical disponible */
  width: 100%;   /* Prend tout l'espace horizontal */
  margin: 0;     /* Enlève la marge pour coller aux bords du panneau */
  
  /* * On a supprimé : 
   * aspect-ratio, max-width, max-height et border 
   * pour un look "full bleed" (bord à bord).
   */ 
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.viewer-shell:active {
  cursor: grabbing;
}
#gpuCanvas {
  width: 1920px;
  height: 1080px;
  max-width: none;
  max-height: none;
  display: block;
  background: #000;
  transform-origin: center center;
  will-change: transform;
}
.viewer-chips {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  gap: 9px;
  pointer-events: none;
}
.chip {
  height: 23px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #222a33;
  background: rgba(5, 7, 10, .82);
  color: #9ba4b5;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
}
.chip.live { color: #63b9ff;; border-color: rgba(255,117,72,.4); }
.safe-frame {
  position: absolute;
  inset: 9%;
  border: 1px dashed rgba(255,255,255,.06);
  z-index: 2;
  pointer-events: none;
}
.safe-frame:before, .safe-frame:after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255,255,255,.25);
}
.safe-frame:before { left: -7%; bottom: -10%; border-right: 0; border-top: 0; }
.safe-frame:after { right: -7%; bottom: -10%; border-left: 0; border-top: 0; }
.empty-viewer {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 9px;
  color: rgba(255,255,255,.45);
  font-family: var(--mono);
  pointer-events: none;
}
.empty-viewer.hidden { display: none; }
.empty-viewer strong { font-size: 18px; letter-spacing: -.04em; }
.empty-viewer span { font-size: 11px; }
.empty-viewer small { font-size: 9px; letter-spacing: .15em; }
.viewer-error {
  position: absolute;
  left: 16px;
  bottom: 16px;
  right: 16px;
  z-index: 4;
  color: #ffd4ca;
  background: rgba(110, 22, 22, .85);
  border: 1px solid rgba(255, 117, 72, .6);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  display: none;
}
.viewer-statusbar {
  height: 31px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  background: #11161c;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
}
.viewer-statusbar b { color: #e7ecf5; }
.viewer-statusbar .right { margin-left: auto; }

.inspector-empty {
  height: calc(100% - 45px);
  display: grid;
  place-content: center;
  text-align: center;
  gap: 13px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .11em;
}
.inspector-icon { font-size: 37px; color: #343d4c; }
.inspector-content { padding: 0; }
.hidden { display: none !important; }
.inspector-content h2 {
  margin: 0 0 18px;
  font-size: 15px;
  letter-spacing: .04em;
  overflow-wrap: anywhere;
}
.inspector-clip-header {
  padding: 18px 18px 12px;
}
.inspector-clip-header h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: .04em;
  overflow-wrap: anywhere;
}

/* --- ACCORDÉONS --- */
.accordion-group {
  border-bottom: 1px solid var(--line-soft);
  border-top: 1px solid transparent;
}
.accordion-header {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: transparent;
  border: none;
  color: #eef3fa;
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease;
}
.accordion-header:hover {
  background: rgba(255, 255, 255, 0.04);
}
.accordion-header .chevron {
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  transition: transform 0.2s ease;
}

/* État ouvert de l'accordéon */
.accordion-group.open .accordion-header .chevron {
  transform: rotate(90deg); /* Tourne la flèche vers le bas */
}
.accordion-group.open .accordion-header {
  border-bottom: 1px solid var(--line-soft);
}
.accordion-body {
  display: none; /* Caché par défaut */
  padding: 14px 18px 18px;
}
.accordion-group.open .accordion-body {
  display: block; /* Affiché quand l'accordéon a la classe 'open' */
}
.inspector-content dl { margin: 0; display: grid; gap: 8px; }
.inspector-content dl div {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  min-height: 28px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
}
.inspector-content dt { color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; }
.inspector-content dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.danger-button {
  margin-top: 18px;
  width: 100%;
  height: 36px;
  background: rgba(255,90,95,.08);
  border-color: rgba(255,90,95,.45);
  color: #ffc6c7;
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.timeline-panel {
  grid-column: 2;
  grid-row: 3;
  border-top: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 50px 1fr;
}
.timeline-toolbar {
  display: grid;
  grid-template-columns: 175px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 13px;
  background: #11161c;
  border-bottom: 1px solid var(--line);
}
.timeline-tabs {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .09em;
}
.timeline-tabs b { color: #f0f4fb; margin-left: 7px; }
.tools { display: flex; gap: 6px; justify-content: flex-start;}
.tool {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
}
.tool.active { background: rgb(0 181 253 / 15%); color: #63b9ff;; border-color: #63b9ff;; }

.zoom-control {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}
.zoom-control input { width: 118px; accent-color: var(--blue); }
.zoom-control output { min-width: 58px; }
.timeline-body {
  display: grid;
  grid-template-columns: 120px 1fr;
  min-height: 0;
  overflow: hidden; /* Force le conteneur à ne pas s'agrandir */
  user-select: none;
}
/* On remplace le Grid par Flexbox */
.track-labels {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #121820;
  
  overflow: hidden; /* Cache la barre de scroll visuelle à gauche */
  min-height: 0;    /* CRUCIAL pour ne pas casser la grille */
  
  /* Attention : on a bien supprimé le padding-top: 28px; qu'il y avait avant ! */
}
.track-labels::before {
  content: '';
  position: sticky;
  top: 0;
  min-height: 28px; /* Hauteur de la règle temporelle */
  background: #10161d;
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.track-label {
  position: relative;
  padding: 8px 8px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  box-sizing: border-box; 
  
  /* AJOUTE CETTE LIGNE : Interdit au navigateur d'écraser la hauteur du label */
  flex-shrink: 0; 
}

.track-label b { display: block; color: #f0f5fc; font-size: 14px; }
.track-label span { color: var(--dim); font-size: 15px; margin-top: 4px; }
.track-label small { position: absolute; right: 6px; top: 8px; color: var(--dim); font-size: 9px; letter-spacing: .14em; }
.track-label.video { border-left: 3px solid #4087ff; height: 62px; }
.track-label.audio { border-left: 3px solid #5bcf8a; height: 62px;}
.timeline-scroll {
  position: relative;
  overflow: auto;
  background: #0d1116;
  min-height: 0; /* CRUCIAL : Permet au scroll de s'activer jusqu'en bas */
}
/* Pour Firefox */
.timeline-scroll,
.track-labels {
  scrollbar-width: none; 
}

/* Pour Chrome, Safari et Edge */
.timeline-scroll::-webkit-scrollbar,
.track-labels::-webkit-scrollbar {
  display: none;
}
.timeline-content {
  position: relative;
  min-height: 100%;
  width: 2520px;
  --sec-width: 84px;
  left: 5px;
}
.ruler {
  position: sticky;
  top: 0;
  height: 28px;
  z-index: 15;
  background: #10161d;
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(to right, rgba(255,255,255,.10) 1px, transparent 1px);
  background-size: var(--sec-width) 100%;
}
.ruler-tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 28px;
  background: #34404c;
  color: #8790a0;
  font-family: var(--mono);
  font-size: 10px;
  padding-left: 4px;
  padding-top: 4px;
  white-space: nowrap;
}
.ruler-tick.minor {
  height: 12px;
  background: #27303a;
  color: transparent;
}
.tracks {
  position: relative;
  min-height: calc(100% - 28px);
  background-image:
    linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(to bottom, transparent calc(100% - 1px), rgba(255,255,255,.04) 1px);
  background-size: var(--sec-width) 100%, 100% 56px;
}
.track-row {
  position: relative;
  height: 62px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,.018);
}
.track-row.audio { height: 62px; background: rgba(73,198,122,.014); }
.track-row.drag-target { outline: 1px solid #63b9ff;; outline-offset: -1px; background: rgba(255,117,72,.055); }

.track-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.track-btn {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid;
  font-size: 10px;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.track-btn:hover {
  border-color: #63b9ff;
}
.track-btn.is-off {
  color: #db343a;
  background: rgba(255, 90, 95, 0.15);
  text-decoration: line-through;
}
.track-btn.is-off:hover {
  border-color: #f8f7f7;
}
.track-btn.delete-btn:hover {
  color: #db343a;
  background: rgba(255, 90, 95, 0.15);
  border-color: #fc0000;
}

/* Griser visuellement la piste si elle est masquée/muette */
.track-row.is-disabled {
  opacity: 0.4;
  background: rgba(0, 0, 0, 0.3);
}

.clips-layer { position: absolute; inset: 0; }
.clip {
  position: absolute;
  top: 6px;
  height: calc(100% - 12px);
  min-width: 0px;
  border-radius: 8px; /* Coins arrondis comme sur ton image */
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  cursor: move;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
  container-type: inline-size;
}
.clip.video {
  background: linear-gradient(180deg, rgba(72, 212, 255, 0.75) 0%, rgba(139, 137, 255, 0.445) 100%);
  border-left: 3px solid #63b9ff;;
}
.clip.audio {
  background: linear-gradient(180deg, rgba(73, 198, 122, 0.75) 0%, rgba(73, 198, 122, 0.1) 100%);
  border-left: 3px solid var(--green);
}
.clip.image {
  background: linear-gradient(180deg, rgba(56, 150, 230, 0.75) 0%, rgba(56, 150, 230, 0.1) 100%);
  border-left: 3px solid var(--blue);
}
/* Poignées latérales (Handles) */
.clip-handle-left, .clip-handle-right {
  width: 10px;
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  flex-shrink: 0; /* <-- AJOUT: Interdit au navigateur d'écraser les poignées */
  z-index: 10;
  max-width: 50%;
}
.clip-handle-left:hover, .clip-handle-right:hover {
  background: rgba(255, 255, 255, 0.5);
}
.clip-info {
  flex: 1;
  padding: 0 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.clip-info span {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}
.clip-info strong {
  display: block;
  font-size: 11px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
/* État sélectionné */
.clip.selected {
  outline: 3px solid #18e1f0;
  outline-offset: 1px;
}
.clip strong {
  display: block;
  padding: 7px 8px 1px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clip span {
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}
.clip .wave {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 12px;
  opacity: .35;
  background: repeating-linear-gradient(90deg, #000 0 2px, transparent 2px 6px);
}

/* Style du clip fantôme pendant le drag & drop */
.clip.ghost {
  opacity: 0.4;
  pointer-events: none; /* CRUCIAL: Empêche le fantôme de bloquer les événements de la souris */
  z-index: 50;
  filter: grayscale(30%);
}

/* Container des boutons d'actions sur le clip */
.clip-actions {
  display: flex;
  gap: 4px;
  padding-right: 6px;
  align-items: center;
}

/* Style des petits boutons (Œil et Note de musique) */
.clip-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 124 255 / 15%);
  border: 1px solid;
  border-color: #00b4ffba;
  font-size: 11px;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.clip-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* État désactivé (Muet ou Masqué) : on barre l'icône en rouge */
.clip-btn.is-off {
  color: #f1141b;
  background: rgb(131 45 47);
  text-decoration: line-through;
  border-color: #db343a;
}
.clip-btn.is-off:hover {
  border-color: #ffffffba;
}
/* Effet sur l'ensemble du clip s'il est masqué visuellement */
.clip.is-hidden {
  background: linear-gradient(180deg, rgba(144, 42, 175, 0.75) 0%, rgba(68, 37, 45, 0.986) 100%);
}
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  left: 0;
  z-index: 16;
  background: #63b9ff;;
  box-shadow: 0 0 12px rgba(255,117,72,.7);
  pointer-events: none;
  height: 100%;
}
.playhead span {
  position: sticky;
  top: 0;
  display: block;
  margin-left: -6px; /* On utilise margin au lieu de left pour centrer */
  width: 14px;
  height: 14px;
  background: #63b9ff;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  z-index: 100;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 100;
  max-width: min(640px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid rgba(255,117,72,.45);
  background: rgba(14, 18, 24, .96);
  color: #f1f5fb;
  font-family: var(--mono);
  font-size: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

.selection-box {
  position: absolute;
  border: 1px solid #63b9ff;
  background: rgba(99, 185, 255, 0.15);
  z-index: 1000;
  pointer-events: none; /* Laisse passer les clics au travers */
  border-radius: 2px;
}
.selection-box.hidden {
  display: none;
}

/* --- DYNAMIC FILTERS --- */
.add-filter-wrapper {
  position: relative;
  margin-top: 10px;
}
.dropdown-menu {
  position: absolute;
  top: 100%; /* S'ouvre vers le bas */
  left: 0;
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
  overflow: hidden;
}
.dropdown-menu button {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.dropdown-menu button:last-child { border-bottom: none; }
.dropdown-menu button:hover { background: rgba(255, 255, 255, 0.06); }

.active-filters-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-item {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.filter-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line-soft);
}
.filter-header strong {
  font-size: 11px;
  text-transform: uppercase;
  font-family: var(--mono);
  color: #eef3fa;
  flex: 1;
}
.filter-actions { display: flex; gap: 4px; }
.filter-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  border-radius: 3px;
  transition: all 0.15s ease;
}
.filter-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border-color: var(--line);
}
.filter-btn.delete:hover {
  color: #ffc6c7;
  background: rgba(255,90,95,0.25);
  border-color: rgba(255,90,95,0.45);
}
.filter-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.filter-body { padding: 8px 10px; }
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-row span {
  width: 55px;
  font-size: 10px;
  color: var(--muted);
}
.filter-row input[type="range"] { flex: 1; }
.filter-row output {
  width: 42px;
  text-align: right;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 10px;
}

/* --- CHAMPS NUMÉRIQUES ÉDITABLES --- */
.val-input-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 48px;
}
.val-input {
  width: 36px; /* <-- On passe de 32px à 36px pour bien voir "200" */
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
  outline: none;
  -moz-appearance: textfield;
  padding: 2px 4px; /* <-- Un petit padding horizontal pour respirer */
  border-radius: 3px;
  transition: background 0.15s, border-color 0.15s;
}
.val-input:focus, .val-input:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}
/* Cache les flèches sur Chrome/Safari/Edge */
.val-input::-webkit-outer-spin-button,
.val-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.val-unit {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 10px;
  margin-left: 2px;
  pointer-events: none; /* Empêche le clic de gêner la sélection */
}

/* --- EDITEUR DE COURBE --- */
.curve-editor-wrapper {
  padding: 10px;
  background: var(--panel-3);
  border-radius: 4px;
  margin-top: 8px;
}
.curve-canvas {
  width: 100%;
  aspect-ratio: 1; /* Carré parfait */
  background: #1e242c;
  border: 1px solid var(--line);
  cursor: crosshair;
  touch-action: none; /* Empêche le scroll sur mobile en dessinant */
}


@media (max-width: 1180px) {
  .app { grid-template-columns: 250px minmax(480px, 1fr) 260px; }
  .time-readout { min-width: 170px; }
  .time-readout output { font-size: 15px; }
}
@container (max-width: 60px) {
  .clip-info, .clip-actions {
    display: none !important;
  }
}