/* Éditeur IA : plein écran à droite de la barre latérale.
   Grille : barre du haut / (outils | aperçu | conversation) / timeline. */
body.is-editor .container { max-width: none; padding: 0; }
body.is-editor .shell-main { height: 100vh; overflow: hidden; }

.editor { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); height: 100vh; background: var(--bg-alt); }
.editor > * { min-width: 0; }

/* ---------- Barre du haut ---------- */
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ed-back { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; text-decoration: none; font-size: 18px; color: var(--muted); }
.ed-back:hover { background: var(--surface-2); color: var(--text); }
.ed-title { font-size: 16px; margin: 0; letter-spacing: -.01em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rev-badge { flex: none; font-size: 12px; font-weight: 650; color: var(--muted); padding: 3px 9px; border-radius: 99px; background: var(--surface-2); }
.ed-top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 17px; cursor: pointer; }
.icon-btn:hover:not(:disabled) { border-color: var(--text); }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* ---------- Zone centrale ---------- */
.ed-main { display: grid; grid-template-columns: 78px minmax(0, 1fr) 360px; min-height: 0; }
.ed-tools { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.ed-tool {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border: 0; border-radius: 10px;
  background: none; cursor: pointer; font-size: 11px; font-weight: 600; color: #3a3a40;
}
.ed-tool:hover { background: var(--surface-2); }
.ed-tool.on { background: var(--accent-soft); color: var(--text); }
.ed-tool.soon { color: #b0b0b5; }
.ed-tool-icon { display: grid; place-items: center; height: 20px; color: var(--text); }
.ed-tool.soon .ed-tool-icon { opacity: .4; }

.ed-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 16px; min-height: 0; min-width: 0; }
.ed-formats { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); flex: none; }
.ed-format { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: 12px; font-weight: 650; cursor: pointer; color: var(--muted); }
.ed-format.on { background: var(--text); color: #fff; }
.ed-canvas { position: relative; flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; container-type: size; }
/* la vidéo garde son format et tient dans la zone, quelle que soit la forme de l'écran */
.ed-frame { position: relative; height: 100cqh; max-width: 100cqw; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #111; box-shadow: var(--shadow-soft); }
.ed-frame[data-aspect="16:9"] { height: auto; width: 100cqw; max-height: 100cqh; }
.ed-frame[data-aspect="1:1"] { height: min(100cqh, 100cqw); }
/* aperçu en direct : la vidéo d'origine remplit le cadre comme le recadrage final (object-position suit
   la personne qui parle) ; les tailles des sous-titres (cqw) se rapportent à la largeur du cadre */
.ed-frame { container-type: inline-size; }
.ed-frame video { width: 100%; height: 100%; display: block; object-fit: cover; cursor: pointer; }
/* textes de l'aperçu : on peut les attraper (le placement et la taille sont posés par editor.js) */
.ed-frame :is(.cap, .hook-ov) { pointer-events: auto; cursor: move; user-select: none; touch-action: none; }
.ed-frame .cap:empty { pointer-events: none; }
/* écriture directe dans le texte affiché : même rendu, avec le curseur et la sélection */
.ed-frame .is-editing { cursor: text; -webkit-user-select: text; user-select: text; outline: none; caret-color: #fff; }
.ed-frame .hook-ov .is-editing { caret-color: #000; }
.ed-frame .is-editing::selection { background: rgba(58, 167, 232, .55); }
.ov-box { position: absolute; z-index: 4; border: 1.5px dashed #fff; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); pointer-events: none; }
.ov-handle {
  position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #0a0a0a;
  pointer-events: auto; touch-action: none;
}
.ov-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.ov-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.ov-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ov-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ov-guide { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; margin-left: -.5px; background: #ff4fd8; z-index: 3; pointer-events: none; }

/* volume de la piste audio */
.wave { cursor: pointer; border-radius: 5px; }
.wave.sel { box-shadow: inset 0 0 0 2px #3aa7e8; }
.vol-pop {
  display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid #cfe9fb;
}
.vol-title { font-size: 12px; font-weight: 700; }
.vol-pop input { width: 160px; accent-color: #3aa7e8; }
.vol-value { min-width: 46px; font-size: 13px; font-variant-numeric: tabular-nums; }
.vol-pop .chip { padding: 4px 10px; font-size: 12px; }
.hook-ov {
  position: absolute; left: 8%; right: 8%; top: 12%; text-align: center; pointer-events: none;
  font-family: "Segoe UI Black", "Arial Black", "Inter Tight", sans-serif; font-weight: 900; font-size: 4.05cqw; line-height: 1.6;
  color: #000;
}
/* comme le rendu (libass, BorderStyle 3) : un bloc blanc derrière chaque ligne */
/* interligne 1,6 et petite marge : les blocs de plusieurs lignes se touchent sans se recouvrir (comme le rendu) */
.hook-ov span { background: var(--hook-bg, #fff); padding: .1em .5em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
/* accroche sans bloc (hook_look background "none") : contour sombre, comme le rendu */
.hook-ov.hook-plain { color: #fff; -webkit-text-stroke: .9cqw #000; paint-order: stroke fill; text-shadow: 0 .2cqw .2cqw rgba(0, 0, 0, .5); }
/* apparence libre des sous-titres (set_caption_look) : effet du mot prononcé et bloc derrière le texte */
.ed-frame .cap.fx-color .w.on { color: var(--accent); }
.ed-frame .cap.fx-pop .w.on { color: var(--accent); font-size: 1.25em; animation: cap-pop .12s ease-out both; }
.ed-frame .cap.fx-box .w.on { color: #000; -webkit-text-stroke: 0; background: var(--accent); border-radius: 1.6cqw; padding: 0 1.85cqw; }
.ed-frame .cap.fx-glow { text-shadow: 0 0 1.3cqw rgba(0, 0, 0, .45), 0 0 1.1cqw var(--accent), 0 0 2.4cqw var(--accent); }
.ed-frame .cap.has-box { text-shadow: none; }
.ed-frame .cap .cap-bg { background: var(--box); padding: .12em .35em; border-radius: 1.2cqw; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.export-btn.is-wait { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: progress; }
.export-btn .spinner { width: 12px; height: 12px; }
.ed-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(250, 250, 248, .72); backdrop-filter: blur(2px); font-weight: 650; font-size: 14px; z-index: 2;
}
.ed-overlay .spinner { width: 22px; height: 22px; border-width: 3px; }

.ed-flyout {
  position: absolute; left: 12px; top: 12px; bottom: 12px; width: 280px; overflow-y: auto; z-index: 3;
  padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft);
}
.fly-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.fly-styles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fly-style { padding: 8px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.fly-style:hover { border-color: var(--line-strong); }
.fly-style.on { border-color: var(--text); background: var(--accent-soft); }
.ed-flyout .swatches { flex-wrap: wrap; }
.ed-flyout .hint { line-height: 1.5; margin: 6px 0 10px; }

/* ---------- Conversation ---------- */
.ed-chat { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-head .btn { margin-left: auto; }
.chat-avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; }
.chat-avatar img { width: 22px; height: 22px; object-fit: contain; }
.rev-list { max-height: 180px; overflow-y: auto; padding: 8px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; background: var(--bg-alt); }
.rev { display: grid; font-size: 12px; color: var(--muted); }
.rev strong { color: var(--text); font-size: 12.5px; }
.rev.current strong::after { content: " · actuelle"; color: #0b5c8f; font-weight: 600; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; font-size: 13.5px; line-height: 1.5; }
.msg p { margin: 0; white-space: pre-line; } /* le plan de motion design : une ligne par animation */
.msg.user { align-self: flex-end; background: var(--surface-2); padding: 9px 12px; border-radius: 14px 14px 4px 14px; }
.msg.agent { align-self: flex-start; }
.msg-status { margin-top: 6px; font-size: 12px; font-weight: 650; color: var(--muted); }
.msg-status.ok { color: var(--ok); }
.msg-status.warn { color: #a15c00; }
.msg-applied { font-size: 12px; color: var(--muted); }
.msg-cost { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.msg-notes { display: grid; gap: 2px; margin-top: 4px; font-size: 12px; color: #a15c00; }
.typing { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .25; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 6px 11px; font-size: 12.5px; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--text); background: var(--accent-soft); }
.chat-form { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 8px 8px 8px 14px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); }
.chat-form:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-input { flex: 1; border: 0; outline: none; resize: none; font: inherit; font-size: 14px; padding: 6px 0; background: transparent; max-height: 140px; }
.chat-send { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); font-size: 16px; font-weight: 800; cursor: pointer; }
.chat-send:disabled { opacity: .5; cursor: default; }
.chat-note { margin: 6px 14px 10px; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- Timeline ---------- */
.ed-timeline { background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px 12px; }
.tl-bar { display: flex; align-items: center; gap: 12px; padding-bottom: 6px; }
.play-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--text); color: #fff; font-size: 12px; cursor: pointer; }
.tl-time { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tl-zoom { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.tl-zoom input { width: 120px; accent-color: #3aa7e8; }
.tl-body { display: grid; grid-template-columns: 86px minmax(0, 1fr); }
.tl-labels { display: grid; grid-template-rows: 20px repeat(6, 30px); gap: 4px; }
.tl-label { font-size: 11.5px; font-weight: 650; color: var(--muted); align-self: center; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; }
.tl-lanes { position: relative; display: grid; grid-template-rows: 20px repeat(6, 30px); gap: 4px; min-width: 100%; cursor: pointer; user-select: none; touch-action: none; }
.tl-ruler { position: relative; border-bottom: 1px solid var(--line); }
.tick { position: absolute; top: 2px; font-size: 10px; color: var(--muted); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.tick:first-child { transform: none; }
.tl-row { position: relative; background: var(--bg-alt); border-radius: 6px; overflow: hidden; }
.tl-block {
  position: absolute; top: 3px; bottom: 3px; border-radius: 5px; padding: 0 5px; font-size: 10.5px; font-weight: 600; line-height: 24px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: inset 0 0 0 1px rgba(10, 10, 10, .08);
}
.cap-block { background: #d9efff; color: #0b4a73; }
.hook-block { background: #fff1b8; color: #6b5200; }
.vid-block { background: #2a2a2e; color: #fff; }
.wave { position: absolute; inset: 3px 0; display: flex; align-items: center; gap: 1px; }
.wave i { flex: 1; min-width: 1px; background: #8fc6ea; border-radius: 1px; }
/* édition dans la timeline */
.tl-tool {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); font-size: 12.5px; font-weight: 650; cursor: pointer;
}
.tl-tool .icon { width: 15px; height: 15px; }
.tl-tool:hover:not(:disabled) { border-color: var(--text); }
.tl-tool:disabled { opacity: .4; cursor: default; }
.tl-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-block.sel { box-shadow: inset 0 0 0 2px #0a0a0a, 0 0 0 2px var(--accent); z-index: 2; }
.vid-block.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cap-block, .hook-block { cursor: text; }
.vid-block { cursor: pointer; }
.handle { position: absolute; top: 0; bottom: 0; width: 12px; cursor: ew-resize; z-index: 3; }
.handle-l { left: 0; border-radius: 5px 0 0 5px; }
.handle-r { right: 0; border-radius: 0 5px 5px 0; }
.vid-block:hover .handle, .vid-block.sel .handle { background: var(--accent); }
.hook-block:hover .handle, .hook-block.sel .handle { background: #e0b400; }
/* pendant un glissement : la variation de durée affichée sur le bloc */
.tl-block[data-label]::after {
  content: attr(data-label); position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; font-weight: 750; padding: 1px 6px; border-radius: 99px; background: #fff; color: #0a0a0a;
}
.tl-edit {
  position: absolute; z-index: 5; min-width: 220px; height: 28px; padding: 0 9px; font: inherit; font-size: 12.5px;
  border: 2px solid var(--text); border-radius: 7px; background: #fff; outline: none; box-shadow: var(--shadow-soft);
}
.fly-words { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.fly-words .fly-style { padding: 7px 0; }

.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #e5484d; pointer-events: none; }
.tl-playhead::before { content: ""; position: absolute; top: 0; left: -4px; width: 10px; height: 10px; border-radius: 2px 2px 50% 50%; background: #e5484d; }

/* ---------- Éditeur IA : envoyer une vidéo à monter ---------- */
.mt-card {
  text-align: left; display: grid; gap: 6px; padding: 18px; border-radius: 22px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-soft);
}
.mt-drop {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 18px; border-radius: 16px; cursor: pointer; text-align: left;
  border: 1.5px dashed var(--line-strong); background: var(--bg-alt); transition: border-color .15s, background .15s;
}
.mt-drop:hover, .mt-drop.drag { border-color: var(--text); background: var(--accent-soft); }
.mt-drop .wc-icon { width: 44px; height: 44px; background: var(--surface); }
.mt-drop-text { display: grid; gap: 2px; }
.mt-drop-text strong { font-size: 15px; }
.mt-drop-text span { color: var(--muted); font-size: 14px; }
.mt-drop-text small { color: var(--muted); font-size: 12px; }
.mt-file { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mt-thumb { flex: none; width: 96px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #111; }
.mt-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-file-text { display: grid; gap: 2px; min-width: 0; }
.mt-file-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-brief { resize: vertical; line-height: 1.5; }
.mt-card .chips { margin-top: 4px; }
.mt-row { display: grid; grid-template-columns: auto 1fr; gap: 18px; margin-top: 6px; }
.mt-formats, .mt-styles { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-opt { padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.mt-opt:hover { border-color: var(--line-strong); }
.mt-opt.on { border-color: var(--text); background: var(--accent-soft); }
.mt-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.picker-job h3 { font-size: 15px; margin: 18px 0 10px; }
@media (max-width: 720px) { .mt-row { grid-template-columns: 1fr; } }

/* ---------- Choix d'un clip ---------- */
.picker-section { margin-bottom: 36px; }
.picker-card { text-decoration: none; }

/* ---------- Petits écrans : l'éditeur s'empile ---------- */
@media (max-width: 1100px) { .ed-main { grid-template-columns: 70px minmax(0, 1fr) 300px; } }
@media (max-width: 900px) {
  body.is-editor .shell-main { height: auto; overflow: visible; }
  .editor { height: auto; min-height: calc(100vh - 60px); grid-template-rows: auto auto auto; }
  .ed-main { grid-template-columns: minmax(0, 1fr); }
  .rev-badge { display: none; }
  .ed-top { padding: 8px 10px; gap: 8px; }
  .tl-body { grid-template-columns: 64px minmax(0, 1fr); }
  .ed-tools { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .ed-tool { min-width: 66px; }
  .ed-canvas { height: 56vh; flex: none; }
  .ed-chat { border-left: 0; border-top: 1px solid var(--line); min-height: 360px; }
  .ed-flyout { left: 8px; right: 8px; width: auto; }
  .ed-title { font-size: 14px; }
}

/* ---------- Effets (lot 1) ---------- */
/* mots-clés : leur couleur, sauf quand c'est le mot prononcé (il garde l'effet du style) */
.ed-frame .cap .w.hl { color: var(--hl); }
.emoji-ov {
  position: absolute; z-index: 2; transform: translate(-50%, -50%); line-height: 1; pointer-events: none;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; animation: emoji-in .18s var(--ease);
}
@keyframes emoji-in { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.flash-ov { position: absolute; inset: 0; z-index: 1; background: #fff; opacity: 0; pointer-events: none; }
.ed-frame video { transform-origin: 50% 50%; }
.fx-zoom { background: #ece2ff; color: #5b2bb5; }
/* motion design : le lecteur Remotion couvre toute l'image, au-dessus des sous-titres */
.motion-ov { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.ed-frame { isolation: isolate; } /* l'animation reste dans l'image, sous les panneaux de l'éditeur */
/* pendant qu'une modification est en cours (l'agent, par exemple), les réglages attendent */
.editor.is-busy .ed-flyout button, .editor.is-busy .ed-formats button { opacity: .5; cursor: progress; }
.motion-ov[hidden] { display: none; }
.fx-motion { background: #dff1ff; color: #1c6ea4; font-weight: 600; }
/* blocs déplaçables à la souris */
.fx-zoom, .fx-emoji, .fx-motion { cursor: grab; touch-action: none; }
.tl-block.dragging { cursor: grabbing; z-index: 3; opacity: .9; box-shadow: 0 6px 16px rgba(10, 40, 70, .25); }
.motion-list { display: grid; gap: 6px; margin: 10px 0; }
.motion-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font: inherit; text-align: left; cursor: pointer;
}
.motion-item.on { border-color: #1c6ea4; box-shadow: 0 0 0 2px #dff1ff; }
.motion-item .hint { margin: 0; }
.beta-badge {
  display: inline-block; padding: 2px 6px; border-radius: 99px; background: var(--accent-soft); color: #1c6ea4;
  font-size: 9.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px;
}
.ed-tool .beta-badge { padding: 1px 4px; font-size: 8px; }
.beta-note { margin-top: 10px; }
.fx-emoji { background: #fff4d6; text-align: center; padding: 0; font-size: 15px; line-height: 24px; }
.fx-cut { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; border-radius: 2px; background: #b9a3e8; }
.fx-row { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.fx-row-text { display: grid; gap: 2px; min-width: 0; }
.fx-row-text strong { font-size: 13.5px; }
.fx-row-text .hint { margin: 0; }
.fx-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-row-actions:empty { display: none; }
.fx-trans { grid-template-columns: repeat(3, 1fr); margin-bottom: 4px; }
.ed-flyout .fx-row + .swatches { margin: -4px 0 8px; }

/* ---------- Montor aux commandes (pendant que l'agent travaille) ---------- */
/* la bulle : la mascotte qui bouge la tête, et l'étape en cours, qui brille */
.agent-mascot { flex: none; width: 28px; height: 28px; animation: mascot-bob 1.4s ease-in-out infinite; filter: drop-shadow(0 2px 6px rgba(28, 110, 164, .35)); }
@keyframes mascot-bob { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-3px) rotate(5deg); } }
.agent-say {
  display: inline-block; font-weight: 600; color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(90deg, var(--muted) 0%, var(--muted) 38%, #1c6ea4 50%, var(--muted) 62%, var(--muted) 100%);
  background-size: 250% 100%; animation: say-shine 1.8s linear infinite;
}
.agent-say.swap { animation: say-shine 1.8s linear infinite, say-in .4s var(--ease); }
@keyframes say-shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes say-in { from { opacity: 0; transform: translateY(5px); filter: blur(3px); } }

/* l'image : un balayage lumineux de haut en bas et un cadre qui pulse */
.agent-scan { position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0; transition: opacity .35s var(--ease); }
.editor.agent-live .agent-scan { opacity: 1; }
.agent-scan::before {
  content: ""; position: absolute; left: 0; right: 0; top: -30%; height: 30%;
  background: linear-gradient(180deg, transparent, rgba(143, 211, 255, .12) 60%, rgba(143, 211, 255, .45) 92%, rgba(255, 255, 255, .9));
  animation: scan 2.4s cubic-bezier(.65, 0, .35, 1) infinite;
}
.agent-scan::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 2px rgba(143, 211, 255, .95), inset 0 0 48px rgba(143, 211, 255, .45);
  animation: frame-pulse 1.6s ease-in-out infinite;
}
@keyframes scan { to { top: 100%; } }
@keyframes frame-pulse { 50% { opacity: .45; } }
.editor.agent-live .ed-frame { box-shadow: 0 0 0 3px #8fd3ff, 0 0 46px rgba(143, 211, 255, .65); transition: box-shadow .35s var(--ease); }
.editor.agent-live .ed-overlay { display: none; } /* la mascotte remplace l'indicateur « Rendu en cours » */

/* la mascotte se promène sur l'image et dit ce qu'elle fait */
.agent-pilot {
  position: absolute; z-index: 7; left: 50%; top: 50%; width: 60px; margin: -30px 0 0 -30px; pointer-events: none;
  opacity: 0; scale: .4; transition: opacity .3s var(--ease), scale .45s var(--ease);
}
.agent-pilot img { display: block; width: 100%; filter: drop-shadow(0 8px 16px rgba(10, 40, 70, .35)); animation: mascot-bob 1.2s ease-in-out infinite; }
.agent-pilot::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 22px; height: 22px; margin: -6px 0 0 -11px; border-radius: 50%;
  border: 2px solid #8fd3ff; animation: tap 1.5s var(--ease) infinite;
}
@keyframes tap { 0% { scale: .3; opacity: 1; } 100% { scale: 2.2; opacity: 0; } }
.agent-pilot-say {
  position: absolute; left: 62px; top: 8px; padding: 6px 11px; border-radius: 12px 12px 12px 4px; white-space: nowrap;
  background: #fff; color: var(--text); font-size: 12.5px; font-weight: 700; box-shadow: 0 6px 18px rgba(10, 40, 70, .18);
}
.agent-pilot-say.swap { animation: say-in .4s var(--ease); }
.editor.agent-live .agent-pilot { opacity: 1; scale: 1; animation: pilot-fly 7s ease-in-out infinite; }
/* parcours relatif à la hauteur de l'aperçu (cqh : le cadre fait 100cqh de haut) */
@keyframes pilot-fly {
  0%, 100% { translate: -14cqh -30cqh; }
  22% { translate: 12cqh -16cqh; }
  45% { translate: -16cqh 4cqh; }
  68% { translate: 10cqh 22cqh; }
  85% { translate: -6cqh 34cqh; }
}

/* la timeline : un reflet qui la parcourt, comme si Montor passait dessus */
.editor.agent-live .tl-lanes::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(143, 211, 255, .38), transparent) no-repeat;
  background-size: 35% 100%; animation: lanes-sweep 1.7s linear infinite;
}
@keyframes lanes-sweep { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.editor.agent-live .ed-tool-icon { animation: tool-glow 2.4s ease-in-out infinite; }
.editor.agent-live .ed-tool:nth-child(2n) .ed-tool-icon { animation-delay: .6s; }
@keyframes tool-glow { 50% { color: #1c6ea4; transform: translateY(-2px); } }

@media (prefers-reduced-motion: reduce) {
  .agent-mascot, .agent-pilot img, .agent-pilot::after, .agent-say, .agent-scan::before, .agent-scan::after,
  .editor.agent-live .agent-pilot, .editor.agent-live .tl-lanes::after, .editor.agent-live .ed-tool-icon { animation: none; }
  .editor.agent-live .agent-pilot { translate: 0 -30cqh; }
  .agent-say { color: var(--muted); background: none; }
}
.msg-choices { padding-left: 4px; }
/* base du montage proposée par Montor : points à cocher */
.base-items { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.base-item { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.35; cursor: pointer; }
.base-item input { flex: none; width: 15px; height: 15px; accent-color: var(--text); }
.base-item input:disabled + span, .base-item input:disabled ~ span { opacity: .75; }
.base-swatch { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
