:root {
  --bg: #090908;
  --panel: #111110;
  --panel-2: #191917;
  --line: rgba(243, 239, 230, 0.1);
  --text: #ffffff;
  --muted: #b5b5b5;
  --ivory: #ffffff;
  --ink: #111111;
  --gold: #cfcfcf;
  --danger: #e07a72;
  --ok: #8fce9a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
img, video { max-width: 100%; }
html, body { margin: 0; height: 100%; background: #000; color: var(--text); }
@supports (height: 100dvh) {
  html, body, .app { height: 100dvh; }
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, textarea, select { border: 0; background: transparent; }
textarea { resize: none; }
.hidden { display: none !important; }

/* --- Page de chargement (splash animé : avion + couteau kabyle + yaz) --- */
#boot-loader {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(243, 239, 230, 0.055), transparent 60%),
    var(--bg);
}
#boot-loader.done { animation: bootExit 0.7s cubic-bezier(0.6, 0.05, 0.3, 1) forwards; }
@keyframes bootExit { to { transform: translateY(-100%); opacity: 0.15; } }

.boot-inner { display: grid; place-items: center; gap: 14px; }

/* Symboles : avion, couteau kabyle, yaz amazigh ⵣ */
.boot-art { display: flex; align-items: center; gap: 16px; height: 46px; }
.art { height: 40px; width: auto; opacity: 0; fill: none; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.art-plane { width: 46px; stroke: var(--ivory); animation: planeSeq 1.5s ease 0.05s forwards; }
.art-knife { width: 86px; animation: knifeSeq 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s forwards; }
.art-yaz { width: 40px; stroke: var(--ivory); animation: yazSeq 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s forwards; }
.k-handle { stroke: var(--ivory); }
.k-blade { fill: rgba(243, 239, 230, 0.06); stroke: #cfcfcf; }
.k-edge { stroke: var(--ivory); opacity: 0.65; }

@keyframes planeSeq {
  0% { opacity: 0; transform: translate(-80px, 18px) rotate(-10deg); }
  30% { opacity: 1; }
  70% { opacity: 1; transform: translate(40px, -8px) rotate(4deg); }
  100% { opacity: 0; transform: translate(140px, -20px) rotate(10deg); }
}
@keyframes knifeSeq {
  0% { opacity: 0; transform: translate(-36px, 14px) rotate(-24deg) scale(0.82); }
  38% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  78% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(8px, -10px) scale(0.7); }
}
@keyframes yazSeq {
  0% { opacity: 0; transform: scale(0.4) rotate(-90deg); }
  45% { opacity: 1; transform: scale(1) rotate(0deg); }
  78% { opacity: 1; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(0.6) rotate(90deg); }
}

/* Le mot « Amini » + le yaz ⵣ */
.boot-word {
  position: relative; display: flex; align-items: baseline;
  font-family: Inter, "Segoe UI", sans-serif; font-weight: 700;
  font-size: 46px; letter-spacing: -0.04em; color: var(--text);
}
.boot-word::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(243, 239, 230, 0.6), transparent);
  transform: scaleX(0); animation: sweep 0.7s ease 1.8s forwards;
}
@keyframes sweep { to { transform: scaleX(1); } }

.ltr {
  display: inline-block; opacity: 0; transform: translateY(16px);
  animation: ltrIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: calc(1.1s + var(--i, 0) * 0.08s);
}
@keyframes ltrIn { to { opacity: 1; transform: none; } }

.boot-yaz {
  width: 30px; height: 30px; margin-left: 3px; align-self: center;
  fill: none; stroke: var(--ivory); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.boot-text {
  color: var(--muted); font-family: Inter, "Segoe UI", sans-serif;
  font-weight: 300; font-size: 14px; letter-spacing: 0.06em;
  opacity: 0; animation: ltrIn 0.5s ease 2.05s forwards;
}

@media (prefers-reduced-motion: reduce) {
  .art { animation: none !important; opacity: 0 !important; }
  .ltr, .boot-text { animation: none !important; opacity: 1 !important; transform: none !important; }
  .boot-word::after { animation: none !important; transform: scaleX(1); }
}

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(243, 239, 230, 0.06), transparent 60%),
    var(--bg);
}
.gate-card { width: min(420px, 100%); display: grid; gap: 14px; }
.mark {
  font-family: Fraunces, Georgia, serif;
  font-size: 64px;
  line-height: 0.9;
  margin: 0;
  letter-spacing: -0.04em;
}
.lede { margin: 0 0 8px; color: var(--muted); max-width: 36ch; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: rgba(243, 239, 230, 0.4); }
button[type="submit"], .primary, #imagine-go {
  background: var(--ivory);
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
}
.ghost {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
}
.form-error { min-height: 1.2em; margin: 0; color: var(--danger); font-size: 14px; }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); }
.check input { width: auto; }

.app { height: 100%; display: grid; grid-template-columns: 272px 1fr; background: #000; }
.rail {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
}
.rail-mark {
  font-family: Fraunces, Georgia, serif;
  margin: 0 0 12px;
  font-size: 22px;
}
.rail button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--muted);
}
.rail button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail button.on, .rail button:hover { background: var(--panel-2); color: var(--ivory); }
#rail-account { margin-top: auto; }

.hist { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.hist-head { padding: 16px; }
#new-chat {
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: #ddd;
  font-weight: 400;
  font-size: 22px;
  line-height: 1;
}
#new-chat:hover { background: #2a2a2a; }
#hist-list { overflow: auto; padding: 0 10px 16px; display: grid; align-content: start; gap: 4px; }
.conv {
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
}
.conv strong { display: block; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.on, .conv:hover { background: var(--panel-2); }
.conv small { font-size: 12px; }

.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 15px; font-weight: 560; margin: 0; letter-spacing: 0.01em; }
#hist-toggle { display: none; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
}
.pill i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.pill.ready i { background: var(--ok); }
.pill.loading i, .pill.download i, .pill.pending i { background: var(--gold); }
.pill.error i { background: var(--danger); }
.top-end { margin-left: auto; }
.credit {
  border: 1px solid rgba(243, 239, 230, 0.30);
  color: var(--gold);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.banner {
  margin: 0;
  padding: 10px 22px;
  background: #221e16;
  color: var(--gold);
  font-size: 14px;
}

.view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.messages {
  flex: 1;
  overflow: auto;
  padding: 28px 8vw 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.msg { max-width: 760px; width: min(760px, 100%); margin: 0 auto; white-space: pre-wrap; text-align: start; }
.msg.assistant { white-space: normal; }
.msg[dir="rtl"] { direction: rtl; text-align: right; }
.msg[dir="ltr"] { direction: ltr; text-align: left; }
.msg.user {
  align-self: end;
  width: auto;
  max-width: min(560px, 86%);
  background: var(--panel-2);
  border-radius: 18px 18px 6px 18px;
  padding: 12px 14px;
}
.msg.assistant { font-size: 15px; }
/* Barre d'actions sous une reponse : alignee, etats lisibles, sans aplat lourd */
.msg-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 10px;
  direction: inherit;
}
.msg-actions button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.48);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.msg-actions button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f2f2f2;
}
.msg-actions button:active { transform: scale(0.92); }
.msg-actions button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}
.msg-actions button.selected {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
/* Avis marque : l'icone se remplit, l'etat se lit d'un coup d'oeil */
.msg-actions button[aria-pressed="true"] svg { fill: currentColor; }
/* "Regenerer" detache : c'est une relance, pas une action sur le texte */
.msg-actions button[aria-label="Régénérer"] { margin-left: 4px; }
.msg-actions svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.msg.pending .md::after { content: "▍"; margin-left: 2px; color: #fff; }
.msg.pending:not(:has(.md))::after { content: " ▍"; color: #fff; }
.msg.error { color: var(--danger); }

.dock {
  width: min(760px, calc(100% - 32px));
  margin: 8px auto 22px;
  display: flex;
  gap: 10px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow);
}
.dock textarea { border: 0; background: transparent; padding: 10px 0; max-height: 160px; }
#send-btn, #imagine-go, #voice-type button {
  width: 42px; height: 42px; padding: 0;
  display: grid; place-items: center; flex: none;
}
#send-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.frame {
  flex: 1;
  min-height: 240px;
  margin: 18px 22px 0;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #0d0d0c;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.frame img, .frame video { max-width: 100%; max-height: 62vh; display: block; }
.frame-empty { color: var(--muted); font-family: Fraunces, Georgia, serif; font-size: 40px; margin: 0; text-align: center; padding: 0 24px; }
.frame-status { position: absolute; left: 16px; bottom: 14px; margin: 0; color: var(--gold); font-size: 14px; max-width: 70%; }
.stage-action {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--ivory);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
}
.shot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; width: min(920px, 100%); }
.shot-grid img { width: 100%; max-height: 34vh; object-fit: contain; background: #000; cursor: pointer; }
.film { display: flex; gap: 8px; overflow: auto; padding: 12px 22px; min-height: 78px; }
.film button { padding: 0; border-radius: 10px; overflow: hidden; border: 1px solid transparent; flex: none; }
.film button.on { border-color: var(--ivory); }
.film img, .film video { width: 92px; height: 64px; object-fit: cover; display: block; }
.imagine-dock { flex-wrap: wrap; width: min(980px, calc(100% - 32px)); align-items: center; }
.opt-row { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; align-items: center; }
.opt-row .lbl { color: var(--muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; min-width: 72px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip, .file-btn {
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  background: #0c0c0b;
}
.chip.on, .file-btn:hover { background: var(--ivory); color: var(--ink); }
.ref-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 4px 8px; }
.ref-row:empty { display: none; }
.ref-chip {
  display: flex; align-items: center; gap: 8px;
  background: #1a1a1a; color: #f2f2f2; border-radius: 12px;
  padding: 4px 6px 4px 4px; font-size: 13px;
}
.ref-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; display: block; }
.ref-chip button { color: #ddd; font-size: 16px; line-height: 1; padding: 0 4px; }
.seg { display: flex; gap: 4px; background: #0c0c0b; border-radius: 999px; padding: 4px; }
.seg button { border-radius: 999px; padding: 8px 12px; color: var(--muted); }
.seg button.on { background: var(--ivory); color: var(--ink); }
#imagine-prompt { flex: 1; min-width: 220px; }
#imagine-go { width: auto; padding: 0 16px; }

/* --- Mode voix : scène centrée façon ChatGPT --- */
.voice-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.8vh, 18px);
  padding: clamp(18px, 6vh, 54px) clamp(12px, 3vw, 28px) max(14px, env(safe-area-inset-bottom));
  overflow: hidden;
}
.voice-hero {
  flex: 0 0 auto;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.orb {
  --orb-size: clamp(120px, 19vh, 190px);
  position: relative;
  width: var(--orb-size);
  height: var(--orb-size);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #07080b;
  cursor: pointer;
  isolation: isolate;
  transition: transform 0.25s ease;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.55);
}
.orb::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(132, 166, 255, 0.35) 0%, rgba(112, 130, 190, 0.12) 45%, transparent 70%);
  filter: blur(20px);
  animation: orb-aura 4.6s ease-in-out infinite;
}
.orb::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: orb-ring 4.6s ease-in-out infinite;
  pointer-events: none;
}
.orb:hover { transform: scale(1.02); }
.orb:active { transform: scale(0.98); }
.orb:focus-visible { outline: 2px solid rgba(160, 190, 255, 0.8); outline-offset: 6px; }
.orb-ball {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 36% 28%, #eef4ff 0%, #9fb4da 22%, #3a4e77 58%, #0b1120 100%);
  box-shadow: inset 0 0 34px rgba(255, 255, 255, 0.2);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  mix-blend-mode: screen;
  opacity: 0.82;
}
.blob.red {
  width: 74%; height: 74%; top: -12%; left: -10%;
  background: radial-gradient(circle at 45% 45%, #dbeafe 0%, #7ca2e8 38%, #2b4a8a 72%, transparent 100%);
  animation: drift-a 7s ease-in-out infinite;
}
.blob.green {
  width: 66%; height: 66%; right: -12%; bottom: -10%;
  background: radial-gradient(circle at 55% 55%, #ede9fe 0%, #a78bfa 38%, #4c1d95 72%, transparent 100%);
  animation: drift-b 8.5s ease-in-out infinite;
}
.blob.white {
  width: 50%; height: 50%; top: 24%; left: 27%;
  background: radial-gradient(circle at 42% 34%, #ffffff 0%, #f1f5ff 38%, #bccce9 68%, transparent 100%);
  animation: drift-c 5.5s ease-in-out infinite;
}
.shine {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.05) 32%, transparent 52%),
    radial-gradient(circle at 68% 80%, rgba(0, 0, 0, 0.3), transparent 46%);
}
.orb.listen::before { animation-duration: 2.6s; }
.orb.listen::after {
  border-color: rgba(150, 185, 255, 0.4);
  box-shadow: 0 0 28px rgba(110, 150, 255, 0.28);
  animation-duration: 2.6s;
}
.orb.listen .blob.red { animation-duration: 2.4s; }
.orb.listen .blob.green { animation-duration: 2.8s; }
.orb.listen .blob.white { animation-duration: 2.1s; }
.orb.think::before { animation-duration: 1.4s; }
.orb.think::after {
  inset: -8px;
  border: 2px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.9);
  border-right-color: rgba(160, 190, 255, 0.45);
  box-shadow: none;
  animation: orb-spin 1.1s linear infinite;
}
.orb.think .blob.white { animation-duration: 1.05s; transform: scale(1.12); }
.orb.think .blob.red { animation-duration: 3.2s; opacity: 0.7; }
.orb.speak { animation: orb-speak 1.15s ease-in-out infinite; }
.orb.speak::before { animation-duration: 1.3s; }
.orb.speak .blob { animation-duration: 1.5s; }
.orb-caption { margin: 0; font-weight: 600; font-size: 16px; letter-spacing: 0; color: #fff; }
@keyframes drift-a {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(28%, 18%) scale(1.3); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes drift-b {
  0% { transform: translate(0, 0) scale(1.05); }
  50% { transform: translate(-30%, -22%) scale(0.88); }
  100% { transform: translate(0, 0) scale(1.05); }
}
@keyframes drift-c {
  0% { transform: translate(0, 8%) scale(0.82); }
  50% { transform: translate(-8%, -18%) scale(1.2); }
  100% { transform: translate(0, 8%) scale(0.82); }
}
@keyframes orb-speak { 50% { transform: scale(1.045); } }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-aura {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 0.95; transform: scale(1.06); }
}
@keyframes orb-ring {
  0%, 100% { opacity: 0.35; transform: scale(0.98); }
  50% { opacity: 0.8; transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .blob, .orb, .orb::before, .orb::after { animation: none !important; }
}
#voice-status {
  margin: 0;
  max-width: 46ch;
  color: #a6a6a6;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.voice-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.voice-latency { margin: 0; min-height: 0; color: #7f7f7f; font-size: 11px; text-align: center; }
.voice-latency:empty { display: none; }
.voice-pick, .voice-agent { width: min(420px, 100%); color: #b5b5b5; font-size: 13px; }
/* Animation d'apparition des images dans les cartes */
.img-anim { opacity: 0; transition: opacity .5s ease; }
.img-anim.img-loaded { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .img-anim { opacity: 1; transform: none; transition: none; } }
.transcript {
  width: min(760px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 6px 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.transcript::-webkit-scrollbar { width: 8px; }
.transcript::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }
.dock.slim { width: min(760px, 100%); margin: 0; }

/* Messages du chat vocal : texte lisible + bouton haut-parleur */
#transcript .msg {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#transcript .msg .msg-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.6;
}
#transcript .msg.assistant .msg-text { color: #ececec; font-size: 15px; padding-top: 2px; }
#transcript .msg.user {
  justify-content: flex-end;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  padding: 0;
  border-radius: 0;
  background: transparent;
  text-align: start;
}
#transcript .msg.user .msg-text {
  flex: 0 1 auto;
  max-width: min(86%, 560px);
  padding: 10px 14px;
  border-radius: 18px 18px 6px 18px;
  background: #262626;
  color: #f4f4f4;
}
/* Bouton "Ecouter" : monochrome, aucun aplat de couleur, emoji desature. */
#transcript .msg-speak {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #b9b9b9;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  align-self: center;
  filter: grayscale(1);
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
#transcript .msg-speak:hover {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
  transform: scale(1.06);
}
#transcript .msg-speak:active { transform: scale(0.94); }
#transcript .msg-speak:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 3px; }
#transcript .msg-text:empty + .msg-speak { display: none; }
/* Barre d'actions dans le transcript vocal : compacte, passe sous le texte */
#transcript .msg { flex-wrap: wrap; }
#transcript .msg .msg-actions { flex: 0 0 100%; margin-top: 4px; }
#transcript .msg-text:empty ~ .msg-actions { display: none; }
#transcript .msg-actions.msg-actions-compact { gap: 2px; }
#transcript .msg-actions.msg-actions-compact button {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.18s ease, background 0.18s ease;
}
#transcript .msg-actions.msg-actions-compact button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
#transcript .msg-actions.msg-actions-compact button.selected {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}
#transcript .msg-actions.msg-actions-compact button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}
#transcript .msg-actions.msg-actions-compact svg { width: 14px; height: 14px; }
html[data-theme="light"] #transcript .msg-actions.msg-actions-compact button { color: #6b6b6b; }
html[data-theme="light"] #transcript .msg-actions.msg-actions-compact button:hover { color: #171717; background: rgba(0, 0, 0, 0.06); }

.admin { display: grid; grid-template-columns: 210px 1fr; min-height: 0; flex: 1; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px 28px; border-right: 1px solid var(--line); overflow: auto; }
.admin-nav button { text-align: left; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: 13.5px; }
.admin-nav button.on, .admin-nav button:hover { background: #1c1c1c; color: var(--text); }
.admin-label { margin: 14px 10px 4px; color: #6f6f6f; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
#admin-body { overflow: auto; min-height: 0; padding: 22px 28px 48px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat b { display: block; font-family: Fraunces, Georgia, serif; font-size: 28px; font-weight: 560; }
.stat span { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0.04em; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin: 0 0 12px;
  display: grid;
  gap: 10px;
}
.bar { height: 6px; background: #2a2926; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); }
.row-actions, .inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline input, .inline select { width: auto; }
.danger { color: var(--danger); }
h2 { font-family: Fraunces, Georgia, serif; font-weight: 560; letter-spacing: -0.03em; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 14px; }

dialog {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 18px;
  width: min(420px, calc(100% - 24px));
  padding: 18px;
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog form { display: grid; gap: 10px; }
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ivory);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  z-index: 5;
  max-width: min(560px, calc(100% - 24px));
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    z-index: 6;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .side.open { transform: none; }
  #side-toggle { display: inline-flex; }
  .admin, .stats { grid-template-columns: 1fr; }
  .messages { padding: 18px 16px; }
  .viewer {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "rail" "stage";
  }
  .viewer-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .feed-card { width: 100%; }
}

.side {
  background: #000;
  color: #f3f3f3;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 10px 10px;
  gap: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.side-foot {
  margin: auto 6px 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #7c7c7c;
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}
.side-foot b { color: #b9b9b9; font-weight: 600; }
.side-foot span { color: #5f5f5f; }
.chat-disclaimer {
  margin: 0 auto;
  max-width: 760px;
  width: 100%;
  padding: 2px 16px 8px;
  color: #7c7c7c;
  font-size: 11.5px;
  text-align: center;
}
.side-nav { display: grid; gap: 2px; }
.side-nav button, .side-label, .icon-btn, .back-btn, .plus-btn, .user-chip, .lib-tools button, .lib-filters button {
  color: #ececec;
}
.side-nav svg, .back-btn svg, .mode-group svg, .icon-btn svg, .viewer-actions svg, .lib-tools svg, #imagine-go svg, .check-btn svg, .side-label svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 15px;
}
.side-nav button.on, .side-nav button:hover { background: #2a2a2a; }
.side-scroll { flex: 1; min-height: 0; overflow: auto; }
.side-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 10px 6px;
  color: #919191;
  font-size: 14px;
}
.side-section-head .icon-btn { width: 28px; height: 28px; font-size: 20px; }
#project-list { display: grid; gap: 2px; padding: 0 4px 8px; }
.side-empty { margin: 0; padding: 5px 10px 8px; color: #777; font-size: 13px; }
.side-project {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  color: #ededed;
  text-align: left;
  font-size: 14px;
}
.side-project svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.side-project span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-project:hover, .side-project.on { background: #292929; }
.side-label-row { display: flex; align-items: center; }
.side-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9a9a9a;
  padding: 14px 10px 6px;
  font-size: 14px;
}
.side-label svg { width: 16px; height: 16px; transition: transform .15s; }
.side-label.shut svg { transform: rotate(-90deg); }
.icon-btn, .plus-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #ddd;
  font-size: 22px;
  line-height: 1;
}
.icon-btn:hover, .plus-btn:hover { background: #2a2a2a; }
.plus-btn { font-size: 26px; font-weight: 300; width: 28px; }
#hist-list { display: grid; gap: 2px; align-content: start; padding: 0 4px 12px; }
.conv {
  position: relative;
  text-align: left;
  padding: 8px 12px;
  border-radius: 12px;
  color: #f2f2f2;
  font-size: 15px;
}
.conv span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.on, .conv:hover { background: #2e2e2e; }
.conv:hover::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #2a2a2a;
  border-radius: 12px;
  padding: 8px 12px;
  white-space: nowrap;
  z-index: 8;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.side-foot { display: grid; gap: 8px; }
.recent-strip { display: none; }
.recent-strip .thumb, .recent-grid {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  flex: none;
  background: #2a2a2a;
  display: grid;
  place-items: center;
}
.recent-strip img, .recent-strip video { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-grid svg { width: 18px; height: 18px; fill: none; stroke: #ddd; stroke-width: 1.6; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 12px; text-align: left; width: 100%; }
.user-chip:hover { background: #2a2a2a; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #3a3a3a; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; flex: none;
}
.user-meta { display: grid; min-width: 0; }
.user-meta strong { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: #9a9a9a; font-size: 12px; }
#side-toggle { display: none; }
.stage { background: #000; }
.top { border-bottom-color: rgba(255,255,255,.06); }

.imagine { position: relative; background: #000; color: #f5f5f5; }
.imagine.home { align-items: center; justify-content: center; }
.imagine.home .imagine-feed, .imagine.home .viewer { display: none; }
.imagine.feed .imagine-home, .imagine.viewing .imagine-home { display: none; }
.imagine.feed .viewer, .imagine.viewing .imagine-feed { display: none; }
.imagine-home { display: flex; flex-direction: column; align-items: center; width: min(980px, calc(100% - 48px)); }
.imagine-home h2 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; text-align: center; }
.imagine.home { gap: 28px; }
.imagine.home .composer { width: min(980px, calc(100% - 48px)); }
.imagine.home:has(#ratio-pop:not(.hidden)) .imagine-home {
  position: absolute;
  top: 28px;
  left: 50%;
  width: min(980px, calc(100% - 48px));
  transform: translateX(-50%);
}
.imagine.feed .composer, .imagine.viewing .composer {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(920px, calc(100% - 28px));
  z-index: 4;
}
.imagine-feed, .viewer { flex: 1; min-height: 0; }
.imagine-feed { display: flex; flex-direction: column; padding: 10px 16px calc(var(--dock-h, 130px) + 18px); }
.feed-top { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; }
.back-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #eee;
}
.back-btn:hover { background: #222; }
.feed-scroll { overflow: auto; padding-top: 12px; }
.prompt-pill {
  display: inline-block;
  max-width: min(520px, 100%);
  background: #2a2a2a;
  border-radius: 999px;
  padding: 8px 14px;
  color: #eee;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: flex-start; }
.feed-card, .lib-tile { cursor: pointer; }
.feed-card {
  position: relative;
  width: min(380px, 48%);
  border-radius: 4px;
  overflow: hidden;
  background: #111;
  padding: 0;
}
.feed-card img, .feed-card video { width: 100%; height: auto; max-height: 46vh; object-fit: contain; background: #000; display: block; }
.play-badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  display: grid; place-items: center;
}
.play-badge svg { width: 16px; height: 16px; fill: #fff; margin-left: 2px; }
.tile-actions { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.feed-card:hover .tile-actions, .lib-tile:hover .tile-actions { display: flex; }
.lib-grid.selecting .tile-actions { display: none; }
.tile-actions button {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,.62); color: #fff; font-size: 14px;
  display: grid; place-items: center;
}
.tile-actions button svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.tile-actions button:hover { background: rgba(0,0,0,.85); }
.suggest { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 28px 0 8px; }
.suggest button { background: #2a2a2a; color: #eee; border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.suggest button:hover { background: #3a3a3a; }
.composer-status { min-height: 0; margin: 0; color: #bdbdbd; font-size: 13px; padding: 0 8px; }
.composer-status:empty { display: none; }

.composer {
  position: relative;
  background: #2c2c2c;
  border-radius: 28px;
  padding: 12px 12px 10px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.composer textarea {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 6px 8px 4px;
  font-size: 17px;
  line-height: 1.4;
  max-height: 140px;
  color: #f3f3f3;
}
.composer textarea::placeholder { color: #8d8d8d; }
.composer-bar { display: flex; align-items: center; gap: 8px; min-height: 42px; flex-wrap: wrap; }
.mode-group, .pill-set, .choice-set {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #3a3a3a;
  border-radius: 999px;
  padding: 3px;
}
.mode-group button, .pill-set button, .choice {
  border-radius: 999px;
  padding: 6px 10px;
  color: #c8c8c8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.mode-group button[data-kind="image"].on {
  color: #fff;
  box-shadow: 0 0 0 1.5px #4c8dff;
  background: transparent;
}
.mode-group button[data-kind="video"].on,
.mode-group button[data-kind="animate"].on,
.pill-set button.on,
.choice.on {
  background: #161616;
  color: #fff;
}
.video-tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.count-select {
  display: none;
  -webkit-appearance: none;
  appearance: none;
  background-color: #3a3a3a;
  color: #f2f2f2;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 24px 5px 12px;
  font-size: 12px;
  line-height: 1.2;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='%23b5b5b5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 11px;
}

/* Bouton « Q » : ouvre UN menu avec Qualité · Durée · Format */
.vopts-btn {
  display: none;
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  background: #3a3a3a; color: #f2f2f2;
  font-weight: 700; font-size: 13px; line-height: 1;
  align-items: center; justify-content: center;
}
#video-opts-pop { left: 0; bottom: calc(100% + 8px); min-width: min(260px, calc(100vw - 32px)); }
.vopts-title { margin: 6px 10px 3px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #8a8a8a; }
.vopts-row { display: flex; gap: 6px; padding: 0 8px 6px; flex-wrap: wrap; }
.vopts-row button {
  flex: 1 1 62px; padding: 7px 8px; border-radius: 9px;
  background: #2f2f2f; color: #eee; font-size: 12px;
}
.vopts-row button:hover { background: #3a3a3a; }
.vopts-row button.on { background: #161616; color: #fff; box-shadow: inset 0 0 0 1px rgba(243, 239, 230, 0.28); }
.ratio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1a1a1a;
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 14px;
}
.ratio-glyph {
  width: 16px; height: 10px; border: 1.5px solid #fff; border-radius: 2px; display: inline-block;
}
#audio-btn.on { color: #fff; }
#audio-btn:not(.on) { color: #8d8d8d; }
#mic-btn { color: #ddd; }

/* Vagues du micro pendant l'enregistrement */
.mic-wave {
  display: flex; align-items: flex-end; justify-content: center; gap: 3px;
  height: 32px; padding: 2px 8px; flex: 1 1 90px; min-width: 70px;
}
.mic-wave.hidden { display: none; }
.mic-wave span { width: 3px; height: 12%; border-radius: 2px; background: var(--gold); transition: height 0.08s linear; }
body.recording #mic-btn, body.recording #chat-mic { color: #e07a72; }
#imagine-go, .check-btn {
  margin-left: auto;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex: none; padding: 0;
}
#imagine-go { background: #3d7eb8; color: #fff; }
#imagine-go:disabled { opacity: .45; }
.check-btn { background: #fff; color: #111; }
.check-btn svg { stroke-width: 2.2; }
.duration-edit { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 140px; }
#duration-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 18px;
  background-color: transparent;
  background-image: radial-gradient(circle, #bdbdbd 1.4px, transparent 1.6px);
  background-size: 12px 8px;
  background-repeat: repeat-x;
  background-position: center;
}
#duration-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0; height: 0;
}

.ratio-pop {
  position: absolute;
  right: 64px;
  bottom: calc(100% + 10px);
  display: flex;
  gap: 8px;
  z-index: 6;
}
.ratio-preview, .ratio-menu, .menu-pop {
  background: #2a2a2a;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.ratio-preview { width: 210px; padding: 12px 12px 8px; }
.ratio-grid {
  position: relative;
  height: 168px;
  border-radius: 10px;
  background-color: #242424;
  background-image:
    linear-gradient(to right, transparent 33%, #3e3e3e 33%, #3e3e3e calc(33% + 1px), transparent calc(33% + 1px), transparent 66%, #3e3e3e 66%, #3e3e3e calc(66% + 1px), transparent calc(66% + 1px)),
    linear-gradient(to bottom, transparent 33%, #3e3e3e 33%, #3e3e3e calc(33% + 1px), transparent calc(33% + 1px), transparent 66%, #3e3e3e 66%, #3e3e3e calc(66% + 1px), transparent calc(66% + 1px));
}
#ratio-frame {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 2px;
}
.ratio-preview p { text-align: center; margin: 10px 0 6px; font-size: 15px; }
.ratio-menu { width: 230px; padding: 8px; display: grid; }
.ratio-menu button, .menu-pop button {
  text-align: left;
  background: transparent;
  color: #f2f2f2;
  border-radius: 10px;
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.ratio-menu button small { color: #9a9a9a; }
.ratio-menu button.on small, .ratio-menu button.on { color: #fff; }
.ratio-menu button:hover, .menu-pop button:hover { background: #383838; }
.menu-pop {
  position: absolute;
  z-index: 7;
  min-width: 220px;
  padding: 6px;
  display: grid;
}
.composer-menu-wrap { position: relative; flex: none; }
.composer-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 9;
  width: min(280px, calc(100vw - 32px));
  padding: 8px;
  display: grid;
  gap: 6px;
  background: #252525;
  border: 1px solid #414141;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.composer-menu > button {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  color: #f2f2f2;
  text-align: left;
}
.composer-menu > button:hover, .composer-menu > button[aria-pressed="true"] { background: #383838; }
.composer-menu label { display: grid; gap: 6px; padding: 6px 10px; color: #c7c7c7; font-size: 13px; }
.composer-menu select { width: 100%; min-width: 0; border: 1px solid #4a4a4a; border-radius: 8px; padding: 8px; background: #171717; color: #fff; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-list:empty { display: none; }
.attachment-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; border: 1px solid #525252; border-radius: 10px; padding: 5px 8px; color: #eee; font-size: 12px; }
.attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip button { width: 22px; height: 22px; border-radius: 50%; background: transparent; color: #fff; }
#plus-pop { left: 8px; bottom: calc(100% - 8px); }
.mention-pop {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 8px);
  background: #2a2a2a;
  border-radius: 14px;
  padding: 8px;
  display: flex;
  gap: 6px;
  z-index: 6;
  max-width: min(420px, 80vw);
  overflow: auto;
}
.mention-pop button { width: 64px; height: 64px; padding: 0; border-radius: 8px; overflow: hidden; flex: none; }
.mention-pop img { width: 100%; height: 100%; object-fit: cover; display: block; }

.viewer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "rail rail"
    "stage actions";
  gap: 12px;
  padding: 12px 16px calc(var(--dock-h, 130px) + 16px);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.viewer-rail {
  grid-area: rail;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: safe center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}
.viewer-rail button {
  width: 54px;
  height: 72px;
  flex: none;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  position: relative;
  background: #161616;
  scroll-snap-align: center;
}
.viewer-rail button.on { border-color: #fff; }
.viewer-rail img, .viewer-rail video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-rail .mini-time {
  position: absolute; left: 4px; bottom: 4px;
  background: rgba(0,0,0,.7); color: #fff; border-radius: 6px;
  font-size: 10px; padding: 1px 4px;
}
.viewer-stage {
  grid-area: stage;
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.viewer-media { max-width: 100%; max-height: 100%; width: 100%; height: 100%; display: grid; place-items: center; min-height: 0; }
.viewer-media img, .viewer-media video {
  max-width: 100%;
  max-height: min(100%, calc(100dvh - var(--dock-h, 150px) - 168px));
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}
.vcontrols {
  position: absolute; left: 16px; right: 16px; bottom: 14px;
  display: flex; align-items: center; gap: 8px; color: #fff;
}
.vcontrols button, .vexpand {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center;
}
.vtime { font-size: 13px; background: rgba(0,0,0,.45); border-radius: 999px; padding: 6px 10px; }
.vseek { flex: 1; accent-color: #fff; }
.vexpand { position: absolute; top: 12px; right: 12px; }
.viewer-media video { max-height: min(100%, calc(100dvh - var(--dock-h, 150px) - 168px)); }
.vextend { width: auto !important; padding: 0 14px; border-radius: 999px !important; font-size: 14px; white-space: nowrap; }
.vextend::after { content: "Rallonger"; margin-left: 6px; }
.extend-menu {
  position: absolute; right: 14px; bottom: 64px; z-index: 30;
  background: rgba(20,20,20,.97); color: #f2f2f2;
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  padding: 12px; display: grid; gap: 10px; width: min(260px, 78vw);
  box-shadow: 0 18px 44px rgba(0,0,0,.55);
}
.extend-title { font-size: 13px; color: #b9b9b9; }
.extend-row { display: flex; gap: 8px; }
.extend-row button {
  flex: 1; padding: 11px 0; border-radius: 10px;
  background: #333; color: #fff; font-size: 14px;
}
.extend-row button:hover { background: #4a4a4a; }
.extend-prompt {
  background: #262626; color: #f2f2f2; border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: 10px; font-size: 14px; width: 100%;
}
.viewer-media:fullscreen { background: #000; display: grid; place-items: center; }
.viewer-media:fullscreen video { max-height: 100vh; max-width: 100vw; border-radius: 0; }
.extend-chip {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  background: rgba(55,55,55,.82);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}
.viewer-actions { grid-area: actions; position: relative; display: flex; flex-direction: column; gap: 8px; justify-content: flex-end; align-self: end; min-width: 0; }
.viewer-actions > button {
  background: #2a2a2a;
  color: #f2f2f2;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.viewer-actions > button .chev { margin-left: auto; color: #aaa; }
.viewer-actions > button.share { background: #fff; color: #111; font-weight: 650; justify-content: center; }
.viewer-actions > button.share svg { stroke: #111; }
.react { display: flex; justify-content: flex-end; gap: 12px; color: #cfcfcf; padding: 6px 2px 0; }
.react button { color: #d0d0d0; font-size: 16px; }
.react button.on { color: #fff; }
#preset-pop, #more-pop { right: 0; bottom: 86px; }

.library { position: relative; background: #000; min-width: 0; overflow: hidden; }
.lib-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; position: sticky; top: 0; background: #000; z-index: 2;
}
.lib-filters { display: flex; gap: 8px; overflow: auto; flex: 1; min-width: 0; }
.lib-filters button, .lib-tools button {
  display: inline-flex; align-items: center; gap: 6px;
  background: #2a2a2a; color: #eee; border-radius: 999px;
  padding: 8px 14px; white-space: nowrap; font-size: 14px;
}
.lib-filters button.on { background: #fff; color: #111; }
.lib-filters button.on svg { stroke: #111; }
.lib-filters svg, .lib-tools svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.lib-tools { display: flex; gap: 8px; }
.lib-tools button.on { background: #fff; color: #111; }
.lib-grid {
  flex: 1; min-width: 0; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px; padding: 0 8px 88px; align-content: start;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.lib-grid.size-small { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.lib-grid.size-medium { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.lib-grid.size-large { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lib-grid.size-small .dur-badge { right: 4px; bottom: 4px; font-size: 10px; padding: 1px 5px; }
.lib-grid.size-small .tick { top: 5px; left: 5px; width: 17px; height: 17px; border-width: 1.5px; }
.lib-sizes {
  display: flex; align-items: center; gap: 2px;
  background: #2a2a2a; border-radius: 999px; padding: 3px;
}
.lib-sizes button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 999px; color: #bbb;
}
.lib-sizes button.on { background: #fff; color: #111; }
.lib-sizes svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.lib-tile {
  position: relative; min-width: 0; height: 0; padding: 56.25% 0 0;
  background: #0b0b0b; overflow: hidden; border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.lib-tile img, .lib-tile video {
  position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0;
  object-fit: contain; display: block; background: #0b0b0b;
}
.dur-badge {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(20,20,20,.78); color: #fff;
  border-radius: 999px; font-size: 12px; padding: 2px 7px;
  backdrop-filter: blur(6px);
}
.tick {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.28);
}
.lib-tile.on .tick { background: #fff; box-shadow: inset 0 0 0 4px #111; }
@media (max-width: 960px) {
  .library .lib-bar { padding-left: 52px; }
  .lib-grid, .lib-grid.size-medium { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .lib-grid.size-small { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .lib-grid.size-large { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 600px) {
  .lib-grid, .lib-grid.size-medium { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 0 5px calc(104px + env(safe-area-inset-bottom)); }
  .lib-grid.size-small { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .lib-grid.size-large { grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 8px; }
  .lib-tile { border-radius: 8px; }
  .lib-bar { flex-wrap: wrap; padding: 8px; gap: 6px; }
  .lib-filters { order: 3; flex-basis: 100%; }
  .lib-tools { margin-left: auto; gap: 6px; }
  .lib-filters button, .lib-tools button { padding: 7px 12px; font-size: 13px; }
  .lib-sizes button { width: 28px; height: 28px; }
  .lib-bulk { width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; row-gap: 6px; }
}
.lib-bulk {
  position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #2a2a2a; border-radius: 16px;
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px; z-index: 3; color: #eee;
  max-width: calc(100% - 24px);
}
.lib-bulk button { background: #3a3a3a; border-radius: 999px; padding: 8px 12px; }
.lib-bulk .danger { color: #ffb4ae; }
.group-list { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.group-list button { text-align: left; background: #222; border-radius: 10px; padding: 8px 10px; }
#lib-menu { position: fixed; z-index: 8; }
.toast { z-index: 20; }

@media (max-width: 960px) {
  #side-toggle { display: inline-flex; }
  .conv:hover::after { display: none; }
}

h1, h2, h3, .mark, .stat b, button, input, textarea, select {
  font-family: Inter, "Segoe UI", sans-serif;
}
.mark { font-weight: 600; letter-spacing: -0.04em; font-size: 44px; }
.gate { background: #000; }
.text-link {
  background: transparent;
  color: #fff;
  padding: 0;
  font-weight: 500;
  justify-self: center;
}
.text-link:hover { text-decoration: underline; }

#chat-view.home {
  justify-content: center;
  align-items: center;
  gap: 22px;
  padding-bottom: 36px;
}
#chat-view.home .messages { display: none; }
#chat-view:not(.home) .chat-hero { display: none; }
.chat-hero h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.045em;
  color: #fff;
  text-align: center;
}
#composer.dock {
  background: #2a2a2a;
  border: 0;
  border-radius: 28px;
  box-shadow: none;
  display: grid;
  gap: 8px;
  padding: 14px 14px 10px;
}
#chat-view.home #composer {
  width: min(810px, calc(100% - 48px));
  margin: 0;
}
#composer.dock { border: 1px solid rgba(255,255,255,.08); background: #202020; }
#composer textarea {
  color: #fff;
  font-size: 16px;
  padding: 6px 8px;
}
#composer textarea::placeholder { color: #8d8d8d; }
.chat-bar { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.chat-bar .icon-btn { width: 36px; height: 36px; }
.chat-bar .icon-btn svg { width: 19px; height: 19px; }
.mode-wrap { position: relative; margin-left: auto; }
.chat-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #ececec;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 999px;
}
.chat-mode:hover, .chat-mode[aria-expanded="true"] { background: #2a2a2a; }
.chat-mode svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#chat-mode-menu { position: absolute; left: 0; bottom: calc(100% + 8px); min-width: 220px; z-index: 6; }
#chat-mode-menu button { display: grid; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; }
#chat-mode-menu button.on, #chat-mode-menu button:hover { background: #2e2e2e; }
#chat-mode-menu small { color: #9a9a9a; font-size: 12px; }
#stop-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
}
#stop-btn svg { width: 14px; height: 14px; fill: #111; stroke: none; }
#chat-mic { color: #eee; }
#send-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
}
#send-btn svg { width: 18px; height: 18px; stroke: #111; fill: none; stroke-width: 1.8; }
.msg { color: #fff; }
.msg.user {
  background: #2c2c2c;
  color: #fff;
  border-radius: 18px;
}
.msg.assistant { font-size: 15px; font-weight: 400; }

.upgrade-card {
  position: fixed;
  right: 22px;
  bottom: 18px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 18px;
  background: radial-gradient(120px 80px at 20% 0%, rgba(80, 120, 255, .18), transparent 70%), #141414;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 14px 14px 14px 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  max-width: min(420px, calc(100% - 32px));
}
.upgrade-card strong { display: block; font-weight: 600; color: #fff; }
.upgrade-card span { color: #9a9a9a; font-size: 13px; white-space: nowrap; }
.upgrade-card button {
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  white-space: nowrap;
}

.plans { overflow: auto; background: #000; }
.plans-wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 64px;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.plans-mark {
  margin: 12px 0 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.04em;
}
.plans-wrap h2 {
  margin: 8px 0 0;
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.03em;
  text-align: center;
  color: #fff;
}
.plans-lede, .plans-note { color: #b5b5b5; text-align: center; margin: 0 0 18px; max-width: 46ch; }
.plan-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-top: 12px;
}
.plan-card {
  background: #171717;
  border-radius: 22px;
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  border: 1px solid transparent;
}
.plan-card.popular {
  border-color: #3c8dff;
  box-shadow: 0 0 0 1px #3c8dff;
}
.plan-card h3 { margin: 0; font-size: 22px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.plan-card .badge {
  background: #163a66;
  color: #8cbcff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
}
.plan-card .blurb { color: #c8c8c8; margin: 0; min-height: 44px; font-size: 14px; }
.plan-card .price { margin: 4px 0 0; font-size: 32px; font-weight: 600; letter-spacing: -0.04em; color: #fff; }
.plan-card .price small { font-size: 16px; font-weight: 500; color: #ddd; letter-spacing: 0; }
.plan-card .choose {
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 600;
  margin: 8px 0 6px;
}
.plan-card ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; }
.plan-card li { display: flex; gap: 10px; align-items: flex-start; color: #eee; font-size: 14px; }
.plan-card li i {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 1.5px solid #888; margin-top: 1px;
}
#plans-back { justify-self: start; }
#status-pills:empty { display: none; }
#voice-view {
  background:
    radial-gradient(1000px 560px at 50% 8%, rgba(120, 148, 205, 0.12), transparent 62%),
    #000;
  color: #fff;
}
.app.voice-mode .top { display: none; }
#voice-type {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px 10px;
  width: min(760px, 100%);
  margin: 0 auto;
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 26px;
  padding: 10px 10px 10px 18px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.4);
}
#voice-type:focus-within { border-color: rgba(255, 255, 255, 0.24); }
#voice-type textarea {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  max-height: 120px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 15px;
  line-height: 1.5;
  overflow-y: auto;
  overflow-wrap: anywhere;
}
#voice-type .attachment-list { grid-column: 1 / -1; }
.voice-type-bar { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; min-width: 0; flex-wrap: wrap; }
.voice-type-bar .composer-menu-wrap { margin-right: auto; }
#voice-type button {
  width: auto;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-weight: 600;
  flex: none;
}
#voice-type .composer-menu button { width: 100%; height: auto; padding: 8px 10px; border-radius: 10px; background: transparent; color: #f2f2f2; font-weight: 400; justify-content: flex-start; }
#voice-type .composer-menu button:hover, #voice-type .composer-menu button[aria-pressed="true"] { background: #383838; }
#voice-type .composer-menu select { height: auto; }
#voice-type .voice-type-bar .plus-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  color: #ddd;
  font-size: 22px;
  font-weight: 300;
}
#voice-type .voice-type-bar .plus-btn:hover { background: #383838; }
#voice-type .mic-mute-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #232323;
  color: #eee;
  font-size: 13px;
  font-weight: 500;
  flex: none;
}
#voice-type .stt-lang {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #232323;
  color: #eee;
  font-size: 12px;
  flex: none;
}
.agent-row { display: flex; gap: 6px; align-items: center; width: 100%; margin-top: 4px; }
.agent-row select {
  flex: 1;
  min-width: 0;
  background: #1d1d1d;
  color: #eee;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 13px;
}
.agent-row button {
  background: #2a2a2a;
  color: #eee;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 6px 9px;
  flex: none;
}
#voice-type .mic-mute-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#voice-type .mic-mute-btn .mic-off-icon { display: none; }
#voice-type .mic-mute-btn.muted {
  background: #3a1d1d;
  border-color: #7a3030;
  color: #ffb4ae;
}
#voice-type .mic-mute-btn.muted .mic-on-icon { display: none; }
#voice-type .mic-mute-btn.muted .mic-off-icon { display: inline-block; }
.voice-settings-wrap { position: relative; margin-left: auto; min-width: 0; }
#voice-type .voice-settings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: min(230px, 50vw);
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #383838;
  color: #f2f2f2;
  font-size: 13px;
  font-weight: 500;
}
.voice-settings-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-settings-toggle svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.voice-settings-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 10;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  max-height: min(72vh, 560px);
  overflow: auto;
  padding: 14px;
  border: 1px solid #414141;
  border-radius: 16px;
  background: #252525;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.voice-settings-menu label { display: grid; gap: 6px; color: #c7c7c7; font-size: 13px; }
#voice-type .voice-settings-menu select,
#voice-type .voice-settings-menu textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #4a4a4a;
  border-radius: 9px;
  padding: 9px 10px;
  background: #171717;
  color: #fff;
  font-size: 14px;
}
#voice-type .voice-settings-menu textarea { resize: vertical; }
#voice-type .voice-settings-menu button {
  width: 100%;
  height: 40px;
  justify-content: flex-start;
  padding: 0 10px;
  border-radius: 9px;
  background: #303030;
  color: #f2f2f2;
  font-size: 14px;
  font-weight: 400;
}
#voice-type .voice-settings-menu button:hover,
#voice-type .voice-settings-menu button[aria-pressed="true"] { background: #414141; }
.vs-label { margin: 2px 0 0; color: #9a9a9a; font-size: 12px; font-weight: 600; }
#voice-type .voice-settings-menu select.vs-full { width: 100%; }
.vs-agent-row { display: flex; gap: 6px; align-items: center; }
.vs-agent-row select { flex: 1; min-width: 0; }
#voice-type .voice-settings-menu .vs-agent-row button {
  width: 40px;
  min-width: 40px;
  height: 38px;
  padding: 0;
  justify-content: center;
}
.vs-instructions { display: grid; gap: 6px; }
#voice-type .voice-settings-menu .vs-save {
  width: auto;
  height: 34px;
  padding: 0 16px;
  justify-self: end;
  border-radius: 999px;
  background: #5a6577;
  color: #fff;
  font-weight: 600;
}
#voice-type .voice-settings-menu .vs-save:hover { background: #6b778c; }
#voice-type .voice-settings-menu .vs-agents {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
#voice-type .voice-settings-menu .vs-agents button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: transparent;
  color: #f2f2f2;
  font-size: 12px;
  font-weight: 500;
}
#voice-type .voice-settings-menu .vs-agents button .agent-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#voice-type .voice-settings-menu .vs-agents .bot-avatar {
  width: 16px;
  height: 16px;
  flex: none;
  border: 0;
  background: transparent;
  font-size: 9px;
}
#voice-type .voice-settings-menu .vs-agents .bot-avatar svg {
  width: 14px;
  height: 14px;
}
#voice-type .voice-settings-menu .vs-agents button.on,
#voice-type .voice-settings-menu .vs-agents button[aria-pressed="true"],
#voice-type .voice-settings-menu .vs-agents button:hover {
  background: #fff;
  color: #111;
  border-color: #fff;
}
.vs-speed { display: flex; align-items: center; gap: 10px; }
.vs-speed input[type=range] { flex: 1; accent-color: #8ea2c4; }
#voice-speed-label, #mic-gain-label { color: #d0d0d0; font-size: 12px; min-width: 42px; text-align: right; }
.vs-level { margin: 0; color: #8d8d8d; font-size: 12px; }
.vs-toggles { display: grid; gap: 6px; margin-top: 2px; }
.mobile-menu {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 7;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: #1c1c1c;
  color: #fff;
}
.composer textarea { font-size: 14px; max-height: 120px; }
@media (max-width: 960px) {
  .app.voice-mode .top { display: none; }
  .plan-grid { grid-template-columns: 1fr; }
  #side-toggle { display: none; }
  .mobile-menu { display: grid; }
  .top { padding-left: 52px; }
  .upgrade-card {
    left: auto;
    right: 10px;
    bottom: 10px;
    max-width: 220px;
    padding: 8px;
    gap: 8px;
  }
  .upgrade-card span { display: none; }
  .app.show-upgrade #chat-view:not(.home) { padding-bottom: 72px; }
  .app.show-upgrade .voice-stage { padding-bottom: 84px; }
  .app.show-upgrade .imagine.feed .composer,
  .app.show-upgrade .imagine.viewing .composer { bottom: 74px; }
  .app.show-upgrade .imagine.home { padding-bottom: 78px; }
  .voice-stage {
    padding: 16px 10px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .voice-hero { gap: 8px; }
  .orb { --orb-size: clamp(96px, 26vw, 132px); }
  .voice-pick, .voice-agent, .transcript, #voice-type { width: 100%; max-width: none; }
  .transcript { padding: 4px 2px 8px; gap: 10px; }
  #voice-type { padding: 8px 8px 8px 14px; border-radius: 22px; }
  #voice-type textarea { font-size: 16px; }
  #transcript .msg { font-size: 15px; }
  .lecons-list { max-height: 150px; }
  .composer-bar, .chat-bar { flex-wrap: nowrap; overflow-x: auto; }
  .imagine.home .composer,
  .imagine.feed .composer,
  .imagine.viewing .composer { width: calc(100% - 16px); }
  .imagine-home h2, .chat-hero h2 { font-size: 22px; }
  .plans { padding-bottom: 28px; }
  .plans-wrap { margin-top: 72px; }

  /* Mobile : composeur/barres toujours visibles et adaptés */
  .imagine-feed { padding-bottom: 156px; }
  .imagine.home .composer,
  .imagine.feed .composer,
  .imagine.viewing .composer {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    transform: none;
    z-index: 40;
  }
  .composer-bar, .voice-type-bar, .chat-bar { flex-wrap: wrap; overflow: visible; min-height: 34px; gap: 6px; }
  /* Téléphone : 1-2-3-4 caché derrière un menu discret, barre plus courte */
  #count-switch { display: none; }
  .count-select { display: inline-block; }
  #image-tools { gap: 6px; }
  #image-tools .choice { padding: 4px 9px; font-size: 12px; }
  .mode-group button, .pill-set button { padding: 5px 9px; font-size: 12px; }
  /* Vidéo : la lettre Q ouvre UN SEUL menu (Qualité · Durée · Format) */
  .vopts-btn { display: inline-flex; width: auto; height: 30px; padding: 0 9px; gap: 4px; border-radius: 999px; }
  #vopts-duration { font-size: 11px; font-weight: 600; opacity: .85; }
  #res-switch, #duration-switch { display: none; }
  #composer.dock, .dock.slim, .composer { width: 100%; border-radius: 18px; }
  .composer textarea, #composer textarea { font-size: 16px; }
  textarea, input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select { font-size: 16px; }
  * { touch-action: manipulation; }
  input[type=range] { touch-action: auto; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .talk-btn { padding: 7px 12px; font-size: 13px; }
  #voice-type .mic-mute-btn { height: 34px; padding: 0 11px; }
  #voice-type .mic-mute-btn .mic-mute-label { display: none; }
  .voice-settings-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: auto;
    max-height: min(60vh, 420px);
    overflow-y: auto;
    z-index: 30;
  }

  /* Déclutter mobile : on garde 🎙 + champ + envoyer ; le reste derrière des icônes */
  #voice-type .composer-menu-wrap { display: none; }
  #voice-type .voice-settings-toggle #voice-settings-label { display: none; }
  #voice-type .voice-settings-toggle::before { content: "⚙"; }
  #voice-type .voice-settings-toggle { padding: 7px 10px; }
  #voice-status { font-size: 12px; }

  /* Admin mobile : nav en barre horizontale, contenu sur toute la hauteur */
  .admin { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    gap: 6px;
  }
  .admin-nav button { white-space: nowrap; padding: 8px 12px; }
  #admin-body { padding: 14px 12px 44px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Leçons : voix de la famille */
.lecons-panel { display: none; width: min(760px, 100%); margin: 0 auto; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 10px 12px; background: rgba(255,255,255,0.02); }
.voice-stage.lecons-open .lecons-panel { display: block; }
.lecons-toggle { display: inline-flex; align-items: center; border: 1px solid var(--line); background: #232323; color: #eee; border-radius: 999px; padding: 7px 11px; font-size: 14px; cursor: pointer; }
.lecons-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.lecons-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow: auto; }
.lecon { padding: 8px; border-radius: 10px; background: rgba(255,255,255,0.03); }
.lecon-mz { font-weight: 600; }
.lecon-fr { font-size: 12px; opacity: .7; }
.lecon-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.lecon-actions audio { height: 30px; }

/* Messages animés (apparition en fondu) */
.msg { animation: msg-in .22s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.talk-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #2b2b2b;
  color: #f2f2f2;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}
.talk-btn:hover { background: #383838; }
.talk-btn.on { background: #fff; border-color: #fff; color: #111; }
#voice-type .talk-btn { background: #2b2b2b; border: 1px solid rgba(255, 255, 255, 0.12); color: #f2f2f2; }
#voice-type .talk-btn:hover { background: #383838; }
#voice-type .talk-btn.on { background: #fff; border-color: #fff; color: #111; }
#voice-type .lecons-toggle { background: #232323; border: 1px solid var(--line); color: #eee; }

/* Carte en cours : le robot réfléchit, photographie, dessine, puis grimace. */
.gen-card {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(420px 220px at 50% 0%, rgba(243, 239, 230, 0.08), transparent 62%),
    #090908;
  color: #f3efe6;
}
.gc-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(243, 239, 230, 0.16);
  z-index: 6;
}
.gc-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: #f3efe6;
  transition: width 0.35s ease;
}
.gen-aminia {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  min-width: 0;
}
.ga-stage {
  position: relative;
  width: min(78%, 260px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  animation: ga-bob 3.2s ease-in-out infinite;
}
.gen-card .am-bot-gen {
  --look: 12px;
  width: 68%;
  height: 78%;
  z-index: 2;
}
.gen-card .am-bot-gen .am-bot-face {
  width: 100%;
  height: 84%;
  border-width: 2px;
}
.gen-card .am-bot-gen .am-bot-think {
  height: 16px;
  gap: 6px;
  animation: ga-dots 18s linear infinite;
}
.gen-card .am-bot-gen .am-bot-think i {
  width: 7px;
  height: 7px;
  opacity: 1;
  animation: am-think 0.85s ease-in-out infinite;
}
.gen-card .am-bot-eye {
  animation: ga-eye 18s linear infinite;
}
.gen-card .ga-eye-r { animation-name: ga-eye-r; }
.gen-card .am-bot-pupil {
  animation: ga-pupil 18s linear infinite;
}
.gen-card .am-bot-mouth {
  opacity: 1;
  border-bottom-width: 2px;
  animation: ga-mouth 18s linear infinite;
}
.ga-brow {
  position: absolute;
  top: 24%;
  width: 16%;
  height: 2px;
  border-radius: 2px;
  background: #f4f4f4;
  transform-origin: center;
}
.ga-brow-l { left: 20%; animation: ga-brow-l 18s linear infinite; }
.ga-brow-r { right: 20%; animation: ga-brow-r 18s linear infinite; }
.ga-tongue {
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: 12%;
  height: 14%;
  border-radius: 0 0 46% 46%;
  background: #e7a0a0;
  transform: translateX(-50%) scaleY(0);
  transform-origin: top center;
  opacity: 0;
  animation: ga-tongue 18s linear infinite;
}
.ga-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(circle at 76% 68%, #fff 0%, rgba(255, 255, 255, 0.55) 8%, transparent 26%);
  opacity: 0;
  animation: ga-flash 18s linear infinite;
}
.ga-cam,
.ga-draw {
  position: absolute;
  z-index: 3;
  color: #f3efe6;
  opacity: 0;
}
.ga-cam {
  right: 0;
  bottom: 10%;
  width: 36%;
  animation: ga-cam 18s linear infinite;
}
.ga-draw {
  left: 0;
  bottom: 6%;
  width: 46%;
  height: 42%;
  animation: ga-draw 18s linear infinite;
}
.ga-cam svg,
.ga-sheet {
  width: 100%;
  height: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ga-sheet { width: 78%; display: block; }
.ga-sheet rect { fill: rgba(243, 239, 230, 0.06); }
.ga-lens,
.ga-bulb { fill: currentColor; stroke: none; }
.ga-pencil {
  position: absolute;
  right: 2%;
  top: -36%;
  width: 18%;
  height: 92%;
  overflow: visible;
  fill: #f3efe6;
  stroke: none;
  transform-origin: 50% 92%;
  animation: ga-pencil 18s linear infinite;
}
.ga-pencil .ga-eraser { fill: #e7a0a0; }
.ga-pencil .ga-wood,
.ga-pencil rect:not(.ga-eraser) { fill: #f3efe6; }
.ga-pencil .ga-lead { fill: #1a1a1a; }
.ga-ink {
  stroke-dasharray: 84;
  stroke-dashoffset: 84;
  animation: ga-ink 18s linear infinite;
}
@keyframes ga-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes ga-dots {
  0%, 20% { opacity: 1; }
  25%, 100% { opacity: 0; }
}
@keyframes ga-eye {
  0%, 7%, 13%, 32% { transform: scaleY(1); }
  8.4%, 11.4% { transform: scaleY(0.08); }
  10% { transform: scaleY(1); }
  34%, 40% { transform: scale(1.04, 0.34); }
  46%, 72% { transform: scaleY(0.32); }
  76%, 80% { transform: scaleY(0.08); }
  83%, 86% { transform: scale(1.12, 1.2); }
  88%, 90% { transform: scaleY(0.9); }
  92%, 95% { transform: scaleY(0.45); }
  97%, 100% { transform: scaleY(1); }
}
@keyframes ga-eye-r {
  0%, 7%, 13%, 32% { transform: scaleY(1); }
  8.4%, 11.4% { transform: scaleY(0.08); }
  10% { transform: scaleY(1); }
  34%, 40% { transform: scale(1.04, 0.34); }
  46%, 72% { transform: scaleY(1); }
  76%, 80% { transform: scaleY(1.05); }
  83%, 86% { transform: scale(1.12, 1.24); }
  88%, 90% { transform: scaleY(0.55); }
  92%, 95% { transform: scaleY(0.45); }
  97%, 100% { transform: scaleY(1); }
}
@keyframes ga-pupil {
  0%, 20% { transform: translate(0, calc(var(--look) * -1.25)); }
  28%, 44% { transform: translate(calc(var(--look) * 1.05), calc(var(--look) * 0.35)); }
  52%, 72% { transform: translate(calc(var(--look) * -0.15), calc(var(--look) * 1.2)); }
  76%, 80% { transform: translate(calc(var(--look) * 0.45), 0); }
  83%, 86% { transform: translate(0, 0) scale(0.6); }
  88%, 91% { transform: translate(calc(var(--look) * -1.15), 0); }
  94%, 100% { transform: translate(0, calc(var(--look) * -0.2)); }
}
@keyframes ga-mouth {
  0%, 22%, 97%, 100% {
    width: 30%;
    height: 11%;
    border: 0;
    border-bottom: 2px solid #f4f4f4;
    border-bottom-left-radius: 80% 100%;
    border-bottom-right-radius: 70% 100%;
    border-radius: 0;
    bottom: 18%;
    transform: translateX(-50%);
  }
  34%, 41% {
    bottom: 18%;
    width: 20%;
    height: 5%;
    border: 0;
    border-bottom: 2px solid #f4f4f4;
    border-radius: 0;
    border-bottom-left-radius: 30% 40%;
    border-bottom-right-radius: 30% 40%;
    transform: translateX(-50%);
  }
  50%, 72% {
    bottom: 18%;
    width: 32%;
    height: 13%;
    border: 0;
    border-bottom: 2px solid #f4f4f4;
    border-radius: 0;
    border-bottom-left-radius: 100% 100%;
    border-bottom-right-radius: 36% 70%;
    transform: translateX(-50%);
  }
  76%, 81% {
    bottom: 18%;
    width: 40%;
    height: 16%;
    border: 0;
    border-bottom: 2px solid #f4f4f4;
    border-radius: 0;
    border-bottom-left-radius: 90% 100%;
    border-bottom-right-radius: 90% 100%;
    transform: translateX(-50%);
  }
  83%, 86% {
    bottom: 16%;
    width: 16%;
    height: 16%;
    border: 2px solid #f4f4f4;
    border-radius: 50%;
    background: transparent;
    transform: translateX(-50%);
  }
  88%, 91% {
    bottom: 18%;
    width: 26%;
    height: 4%;
    border: 0;
    border-bottom: 2px solid #f4f4f4;
    border-radius: 0;
    transform: translateX(-50%);
  }
  92.5%, 95% {
    bottom: 24%;
    width: 30%;
    height: 10%;
    border: 0;
    border-bottom: 2px solid #f4f4f4;
    border-radius: 0;
    border-bottom-left-radius: 70% 100%;
    border-bottom-right-radius: 70% 100%;
    transform: translateX(-50%);
  }
}
@keyframes ga-brow-l {
  0%, 20% { transform: translateY(0) rotate(8deg); }
  34%, 42% { transform: translateY(-4px) rotate(-10deg); }
  50%, 72% { transform: translateY(2px) rotate(18deg); }
  76%, 81% { transform: translateY(3px) rotate(10deg); }
  83%, 86% { transform: translateY(-6px) rotate(-16deg); }
  88%, 91% { transform: translateY(-5px) rotate(-20deg); }
  94%, 100% { transform: translateY(0) rotate(6deg); }
}
@keyframes ga-brow-r {
  0%, 20% { transform: translateY(0) rotate(-8deg); }
  34%, 42% { transform: translateY(-4px) rotate(10deg); }
  50%, 72% { transform: translateY(0) rotate(-4deg); }
  76%, 81% { transform: translateY(-2px) rotate(8deg); }
  83%, 86% { transform: translateY(-6px) rotate(16deg); }
  88%, 91% { transform: translateY(2px) rotate(12deg); }
  94%, 100% { transform: translateY(0) rotate(-6deg); }
}
@keyframes ga-tongue {
  0%, 91%, 96%, 100% { opacity: 0; transform: translateX(-50%) scaleY(0); }
  92.5%, 94.5% { opacity: 1; transform: translateX(-50%) scaleY(1); }
}
@keyframes ga-flash {
  0%, 33%, 42%, 100% { opacity: 0; }
  35% { opacity: 0.95; }
  36.6% { opacity: 0.08; }
  38% { opacity: 0.8; }
}
@keyframes ga-cam {
  0%, 21% { opacity: 0; transform: translate(14px, 16px) rotate(14deg); }
  27%, 44% { opacity: 1; transform: translate(0, 0) rotate(-8deg); }
  50%, 100% { opacity: 0; transform: translate(10px, 12px) rotate(8deg); }
}
@keyframes ga-draw {
  0%, 46%, 78%, 100% { opacity: 0; transform: translateY(12px); }
  52%, 73% { opacity: 1; transform: none; }
}
@keyframes ga-pencil {
  0%, 48%, 76%, 100% { transform: rotate(-26deg); }
  58% { transform: rotate(-6deg) translate(-3px, 2px); }
  68% { transform: rotate(-18deg) translate(2px, -1px); }
}
@keyframes ga-ink {
  0%, 50%, 80%, 100% { stroke-dashoffset: 84; }
  70% { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ga-stage,
  .gen-card .am-bot-think,
  .gen-card .am-bot-think i,
  .gen-card .am-bot-eye,
  .gen-card .am-bot-pupil,
  .gen-card .am-bot-mouth,
  .ga-brow,
  .ga-tongue,
  .ga-flash,
  .ga-cam,
  .ga-draw,
  .ga-pencil,
  .ga-ink { animation: none; }
  .ga-cam, .ga-draw, .ga-flash, .ga-tongue { opacity: 0; }
  .gen-card .am-bot-think,
  .gen-card .am-bot-think i,
  .gen-card .am-bot-mouth { opacity: 1; }
  .gen-card .am-bot-pupil { transform: translate(0, calc(var(--look) * -1)); }
  .gc-bar-fill { transition: none; }
}

@media (max-width: 600px) {
  #imagine-prompt { min-width: 0; }
  .composer-bar { gap: 4px; }
  #audio-btn { display: none; }
  #image-tools { order: 1; flex: 0 1 auto; }
  #image-tools .choice { white-space: nowrap; }
  #count-select { max-width: 108px; }
  #ratio-btn { order: 1; }
  #video-opts-pop { width: calc(100vw - 16px); max-width: calc(100vw - 16px); }
  .vopts-row.vopts-formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vopts-row.vopts-formats button { min-width: 0; padding-left: 4px; padding-right: 4px; }
}
@media (max-width: 380px) {
  #kind-switch .mode-label { display: none; }
  #kind-switch button { padding-left: 8px; padding-right: 8px; }
  #video-tools { gap: 4px; }
  #ratio-btn { order: 0; }
  .vopts-row button { white-space: nowrap; }
  .imagine.viewing #vopts-duration { display: none; }
  .imagine.viewing .vopts-btn { width: 30px; padding: 0; }
  .imagine.viewing .composer-bar { gap: 3px; }
  .voice-type-bar { gap: 4px; }
  #voice-type .talk-btn { padding: 6px 9px; font-size: 12px; }
  #voice-type .mic-mute-btn { padding: 0 8px; }
  #voice-type .lecons-toggle { padding: 6px 8px; font-size: 13px; }
  #voice-type .voice-settings-toggle { padding: 0 9px; }
  #voice-type .voice-type-bar .plus-btn { width: 28px; }
  #voice-type .voice-type-bar button[type=submit] { padding: 0 10px; }
}
@media (max-width: 340px) {
  #ratio-btn { padding: 0 6px; }
  #ratio-btn span { display: none; }
}


#prompt-collapse {
  display: none;
  position: absolute;
  top: 4px;
  right: 48px;
  width: 28px;
  height: 24px;
  border-radius: 8px;
  background: #3a3a3a;
  color: #ddd;
  font-size: 13px;
  line-height: 1;
  z-index: 4;
}
#imagine-form.collapsed #imagine-prompt,
#imagine-form.collapsed #ref-row,
#imagine-form.collapsed #composer-status { display: none; }

@media (max-width: 960px) {
  .viewer {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "rail" "stage";
    gap: 8px;
    padding: 8px 8px calc(var(--dock-h, 150px) + 10px + env(safe-area-inset-bottom));
  }
  .viewer-rail {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 0 2px;
    scroll-snap-type: x proximity;
  }
  .viewer-rail button { width: 46px; height: 62px; scroll-snap-align: start; }
  .viewer-stage { min-height: 0; }
  .viewer-actions { display: none; }
  .extend-chip { display: none; }
  .vcontrols { left: 8px; right: 8px; bottom: 8px; gap: 6px; }
  .vtime { white-space: nowrap; font-size: 11px; padding: 4px 7px; }
  .vseek { min-width: 0; }
  .vcontrols .vextend { display: none; }
  .viewer-media img, .viewer-media video {
    max-height: calc(100dvh - var(--dock-h, 168px) - 148px - env(safe-area-inset-bottom));
    max-width: 100%;
  }
  #viewer-more-pop { right: 46px; bottom: calc(100% + 8px); min-width: min(240px, calc(100vw - 24px)); max-height: 62vh; overflow: auto; }
  .ratio-pop { position: absolute; left: 8px; right: 8px; justify-content: center; }
  .ratio-preview { width: 112px; padding: 8px 8px 6px; }
  .ratio-grid { height: 84px; }
  .ratio-preview p { font-size: 12px; margin: 8px 0 4px; }
  .ratio-menu { width: auto; flex: 1 1 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #prompt-collapse { display: grid; place-items: center; }
}

.side-scroll, #hist-list { min-width: 0; }
.conv { min-width: 0; width: 100%; max-width: 100%; }
.side-scroll { overflow-x: hidden; }

@media (max-width: 600px) {
  .admin form.card .inline { display: grid; grid-template-columns: 1fr; }
  .admin form.card .inline > * { width: 100%; max-width: 100%; min-width: 0; }
  .table-wrap { max-width: 100%; overflow-x: auto; }
}
.table-wrap { max-width: 100%; overflow-x: auto; }

/* --- Studio façon Grok : marque, recherche, markdown, suggestions --- */
.side-brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 2px; }
.side-logo {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.05em;
  padding: 4px 6px;
  border-radius: 10px;
}
.side-logo:hover { background: #161616; }
.side-brand .icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 4px 4px;
  padding: 0 10px;
  height: 36px;
  border-radius: 12px;
  background: #141414;
  border: 1px solid rgba(255,255,255,.06);
  color: #8d8d8d;
}
.side-search svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; flex: none; }
.side-search input { border: 0; background: transparent; padding: 0; height: 34px; color: #fff; }
.side-search input:focus { border: 0; }
.legal {
  margin: 0 8px 4px;
  color: #5c5c5c;
  font-size: 10.5px;
  line-height: 1.45;
  text-align: center;
}
.legal b { color: #8a8a8a; font-weight: 600; }
.app.collapsed { grid-template-columns: 0 1fr; }
.app.collapsed .side { border: 0; overflow: hidden; }
.app.collapsed .mobile-menu { display: grid; }
.hist-group { margin: 12px 10px 4px; color: #6e6e6e; font-size: 12px; font-weight: 500; }
.conv { display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.conv > span { flex: 1; min-width: 0; }
.conv-more {
  width: 26px; height: 26px; border-radius: 8px; color: #bdbdbd; flex: none;
  opacity: 0; font-size: 16px; line-height: 1;
}
.conv:hover .conv-more, .conv.on .conv-more, .conv-more:focus { opacity: 1; }
@media (max-width: 960px) { .conv-more { opacity: 1; } }
.conv-more:hover { background: #3a3a3a; color: #fff; }
#conv-menu { position: fixed; z-index: 30; min-width: 168px; }
#conv-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; }
#conv-menu button:hover { background: #2e2e2e; }
#conv-menu .danger { color: #ffb4ae; }
.chat-suggest {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(810px, calc(100% - 48px));
  margin: 4px auto 0;
}
#chat-view.home .chat-suggest { display: flex; }
.chat-suggest button {
  border: 1px solid rgba(255,255,255,.1);
  background: #141414;
  color: #ececec;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13.5px;
}
.chat-suggest button:hover { background: #222; }
.md { font-size: 15.5px; line-height: 1.65; }
.md p { margin: 0 0 0.75em; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 1em 0 0.4em; letter-spacing: -0.03em; line-height: 1.25; }
.md h1 { font-size: 1.35em; }
.md h2 { font-size: 1.18em; }
.md h3 { font-size: 1.05em; }
.md ul, .md ol { margin: 0.2em 0 0.8em; padding-left: 1.3em; }
.md li { margin: 0.2em 0; }
.md blockquote {
  margin: 0.4em 0 0.8em;
  padding-left: 12px;
  border-left: 2px solid rgba(255,255,255,.2);
  color: #d0d0d0;
}
.md a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #1c1c1c;
  border-radius: 6px;
  padding: 0.1em 0.35em;
}
.md pre.code {
  position: relative;
  margin: 0.6em 0 0.9em;
  padding: 14px 14px 12px;
  background: #141414;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  overflow: auto;
}
.md pre.code code { background: none; padding: 0; white-space: pre; }
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  color: #ddd;
  background: #2a2a2a;
  border-radius: 8px;
  padding: 4px 8px;
}
.code-copy:hover { background: #3a3a3a; color: #fff; }
.msg.user { border-radius: 22px; background: #2a2a2a; padding: 10px 14px; }
.msg-edit {
  display: block;
  margin-top: 6px;
  color: #8d8d8d;
  font-size: 12px;
  padding: 0;
  opacity: 0;
}
.msg.user:hover .msg-edit, .msg-edit:focus { opacity: 1; }
.msg-edit:hover { color: #fff; }
#chat-view { position: relative; }
#chat-view.home .chat-disclaimer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  margin: 0 auto;
}
.style-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; max-width: 720px; }
.style-chip {
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: #ddd;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}
.style-chip.on, .style-chip:hover { background: #fff; color: #111; border-color: #fff; }
.alert {
  border-radius: 14px;
  padding: 10px 12px;
  background: #161616;
  border: 1px solid rgba(255,255,255,.08);
  margin: 0 0 8px;
}
.alert.critical { border-color: rgba(224,122,114,.5); }
.alert.warning { border-color: rgba(230,190,120,.45); }
.alert.ok { border-color: rgba(143,206,154,.35); }
.alert strong { display: block; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
@media (max-width: 800px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#composer.dock { background: #1c1c1c; border-radius: 26px; }
.imagine-home h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.045em; font-weight: 600; }
.composer { background: #1c1c1c; border: 1px solid rgba(255,255,255,.08); }

/* Voix : orbe au centre, un seul micro en bas */
.voice-stage { justify-content: flex-end; gap: 12px; }
.voice-hero {
  flex: 1 1 auto;
  margin: 0;
  justify-content: center;
}
.transcript { flex: 0 0 auto; max-height: min(24vh, 220px); }
.transcript:empty { display: none; }
.voice-panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .voice-panel-row { grid-template-columns: 1fr; } }
.voice-dock { display: flex; justify-content: center; flex: none; padding: 8px 0 18px; }
.voice-mic {
  width: 76px;
  height: 76px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.voice-mic svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.voice-mic .mic-off-icon { display: none; }
.voice-mic.on { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.14), 0 12px 32px rgba(0, 0, 0, 0.35); }
.voice-mic.muted { background: #3a1d1d; color: #ffb4ae; }
.voice-mic.muted .mic-on-icon { display: none; }
.voice-mic.muted .mic-off-icon { display: block; }

/* Menu compte, paramètres, utilisation — même panneau */
.side-foot { position: relative; }
.user-pop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 16px;
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.user-pop button {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: #f3f3f3;
  background: transparent;
  font-weight: 500;
}
.user-pop button svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.user-pop button:hover { background: #2a2a2a; }
.theme-row { display: flex; gap: 6px; }
.user-pop .theme-row button,
.pref-block .theme-row button {
  width: auto;
  flex: 1;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
}
.theme-row button.on { background: #fff; color: #111; border-color: #fff; }
.user-pop #logout-btn { margin-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.08); border-radius: 0 0 10px 10px; }
.pref-view { overflow: auto; background: #000; }
.pref {
  width: min(640px, calc(100% - 32px));
  margin: 28px auto 56px;
  display: grid;
  gap: 14px;
}
.pref-head { display: flex; align-items: center; gap: 8px; }
.pref-head h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.04em; }
.pref-head .back-btn { width: 36px; height: 36px; }
.pref-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pref-block h3 { margin: 0; font-size: 15px; font-weight: 600; }
.pref-field { display: grid; gap: 6px; color: #b5b5b5; font-size: 13px; }
.pref-note { margin: 0; color: #9a9a9a; }
.pref-actions { display: flex; justify-content: flex-end; gap: 8px; }
.usage-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.usage-row strong { font-weight: 600; }
#usage-body > button {
  justify-self: start;
  margin-top: 8px;
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
}
#voice-type.voice-panel {
  width: min(720px, 100%);
  max-height: min(40vh, 420px);
  overflow: auto;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  padding: 16px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: none;
}
#voice-type.voice-panel textarea,
#voice-type.voice-panel select,
#voice-type.voice-panel .stt-lang {
  grid-column: auto;
  width: 100%;
  height: auto;
  max-height: 140px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: #101010;
  color: #f3f3f3;
}
#password-form button[type="submit"] {
  justify-self: start;
  width: auto;
  border-radius: 999px;
  padding: 10px 16px;
}
#voice-type.voice-panel button {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: transparent;
  color: #f2f2f2;
  font-weight: 500;
  justify-content: flex-start;
}
#voice-type.voice-panel button:hover,
#voice-type.voice-panel button[aria-pressed="true"] { background: #2a2a2a; }
#voice-type.voice-panel button[type="submit"],
#voice-type.voice-panel .vs-save {
  width: auto;
  justify-self: end;
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 0 16px;
}
#voice-type.voice-panel .vs-agent-row button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  justify-content: center;
}
.voice-panel .lecons-panel,
.pref .lecons-panel {
  display: block;
  width: 100%;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}
#voice-type.voice-panel .mic-mute-btn.muted { background: #3a1d1d; color: #ffb4ae; }

/* Mode clair — toute l'application */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f4f4f4;
  --panel-2: #ececec;
  --line: rgba(0, 0, 0, 0.1);
  --text: #171717;
  --muted: #5c5c5c;
  --gold: #444444;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] body,
html[data-theme="light"] .app,
html[data-theme="light"] .stage,
html[data-theme="light"] .side,
html[data-theme="light"] .gate,
html[data-theme="light"] .imagine,
html[data-theme="light"] .pref-view,
html[data-theme="light"] #voice-view {
  background: #fff;
  color: #171717;
}
html[data-theme="light"] .side { border-right-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .side-nav button,
html[data-theme="light"] .side-label,
html[data-theme="light"] .icon-btn,
html[data-theme="light"] .back-btn,
html[data-theme="light"] .plus-btn,
html[data-theme="light"] .user-chip,
html[data-theme="light"] .side-project,
html[data-theme="light"] .conv { color: #171717; }
html[data-theme="light"] .side-nav button.on,
html[data-theme="light"] .side-nav button:hover,
html[data-theme="light"] .side-project:hover,
html[data-theme="light"] .side-project.on,
html[data-theme="light"] .conv.on,
html[data-theme="light"] .conv:hover,
html[data-theme="light"] .user-chip:hover,
html[data-theme="light"] .icon-btn:hover,
html[data-theme="light"] .plus-btn:hover,
html[data-theme="light"] .side-logo:hover { background: #f2f2f2; }
html[data-theme="light"] .side-search { background: #f4f4f4; border-color: transparent; }
html[data-theme="light"] .side-search input,
html[data-theme="light"] #composer textarea,
html[data-theme="light"] .composer textarea,
html[data-theme="light"] .chat-hero h2,
html[data-theme="light"] .imagine-home h2,
html[data-theme="light"] .msg,
html[data-theme="light"] .mark,
html[data-theme="light"] .text-link { color: #171717; }
html[data-theme="light"] .side-section-head,
html[data-theme="light"] .side-label,
html[data-theme="light"] .user-meta small,
html[data-theme="light"] .chat-disclaimer,
html[data-theme="light"] #voice-status { color: #6b6b6b; }
html[data-theme="light"] .avatar { background: #e6e6e6; color: #171717; }
html[data-theme="light"] #composer.dock,
html[data-theme="light"] .composer,
html[data-theme="light"] .pref-block,
html[data-theme="light"] #voice-type.voice-panel,
html[data-theme="light"] .user-pop,
html[data-theme="light"] .menu-pop,
html[data-theme="light"] .composer-menu,
html[data-theme="light"] dialog {
  background: #f4f4f4;
  color: #171717;
  border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .msg.user { background: #ececec; color: #171717; }
html[data-theme="light"] .user-pop button,
html[data-theme="light"] #voice-type.voice-panel button { color: #171717; }
html[data-theme="light"] .user-pop button:hover,
html[data-theme="light"] #voice-type.voice-panel button:hover,
html[data-theme="light"] #voice-type.voice-panel button[aria-pressed="true"],
html[data-theme="light"] .chat-mode:hover { background: #e7e7e7; }
html[data-theme="light"] .theme-row button.on,
html[data-theme="light"] #voice-type.voice-panel button[type="submit"],
html[data-theme="light"] #voice-type.voice-panel .vs-save,
html[data-theme="light"] #usage-body > button,
html[data-theme="light"] #send-btn,
html[data-theme="light"] #stop-btn { background: #171717; color: #fff; }
html[data-theme="light"] #send-btn svg,
html[data-theme="light"] #stop-btn svg { stroke: #fff; fill: none; }
html[data-theme="light"] .voice-mic { background: #171717; color: #fff; }
html[data-theme="light"] .voice-mic.on { box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.12); }
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select { background: #fff; color: #171717; border-color: rgba(0, 0, 0, 0.12); }
html[data-theme="light"] .style-chip { color: #333; border-color: rgba(0, 0, 0, 0.12); }
html[data-theme="light"] .style-chip.on,
html[data-theme="light"] .style-chip:hover { background: #171717; color: #fff; border-color: #171717; }
html[data-theme="light"] .mobile-menu { background: #f4f4f4; color: #171717; }
html[data-theme="light"] .upgrade-card { background: #fff; color: #171717; border-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .upgrade-card strong { color: #171717; }
html[data-theme="light"] button[type="submit"],
html[data-theme="light"] .primary,
html[data-theme="light"] #password-form button[type="submit"] { background: #171717; color: #fff; }
html[data-theme="light"] .library,
html[data-theme="light"] .lib-bar,
html[data-theme="light"] .plans,
html[data-theme="light"] .gate,
html[data-theme="light"] #boot-loader,
html[data-theme="light"] .top { background: #fff; color: #171717; }
html[data-theme="light"] .plans h2,
html[data-theme="light"] .plans-mark,
html[data-theme="light"] .plan-card,
html[data-theme="light"] .plan-card .price,
html[data-theme="light"] .plan-card .blurb,
html[data-theme="light"] .plan-card li { color: #171717; }
html[data-theme="light"] .plan-card { background: #f4f4f4; border-color: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .plan-card .choose { background: #171717; color: #fff; }
html[data-theme="light"] .lib-filters button,
html[data-theme="light"] .lib-tools button,
html[data-theme="light"] .lib-sizes,
html[data-theme="light"] .suggest button,
html[data-theme="light"] .prompt-pill,
html[data-theme="light"] .chat-suggest button,
html[data-theme="light"] .mode-group,
html[data-theme="light"] .pill-set,
html[data-theme="light"] .choice-set,
html[data-theme="light"] .ratio-pill,
html[data-theme="light"] .count-select,
html[data-theme="light"] .vopts-btn,
html[data-theme="light"] .vopts-row button,
html[data-theme="light"] .chat-mode,
html[data-theme="light"] .plus-btn,
html[data-theme="light"] .back-btn,
html[data-theme="light"] .user-pop .theme-row button,
html[data-theme="light"] .pref-block .theme-row button {
  background: #ececec;
  color: #171717;
  border-color: transparent;
}
html[data-theme="light"] .mode-group button,
html[data-theme="light"] .pill-set button,
html[data-theme="light"] .choice { color: #333; background: transparent; }
html[data-theme="light"] .mode-group button[data-kind="video"].on,
html[data-theme="light"] .mode-group button[data-kind="animate"].on,
html[data-theme="light"] .pill-set button.on,
html[data-theme="light"] .choice.on,
html[data-theme="light"] .lib-filters button.on,
html[data-theme="light"] .lib-tools button.on,
html[data-theme="light"] .lib-sizes button.on,
html[data-theme="light"] .vopts-row button.on,
html[data-theme="light"] .theme-row button.on,
html[data-theme="light"] .chip.on,
html[data-theme="light"] .seg button.on {
  background: #171717;
  color: #fff;
  border-color: #171717;
}
html[data-theme="light"] .ratio-glyph { border-color: #171717; }
html[data-theme="light"] .lib-filters button.on svg,
html[data-theme="light"] .lib-sizes button.on { color: #fff; }
html[data-theme="light"] #transcript .msg.assistant .msg-text,
html[data-theme="light"] #transcript .msg.user .msg-text { color: #171717; }
html[data-theme="light"] #transcript .msg.user .msg-text { background: #ececec; }
html[data-theme="light"] #transcript .msg-speak {
  background: transparent;
  color: #6b6b6b;
  border-color: rgba(0, 0, 0, 0.18);
}
html[data-theme="light"] #transcript .msg-speak:hover {
  color: #171717;
  border-color: rgba(0, 0, 0, 0.5);
}
html[data-theme="light"] .md code,
html[data-theme="light"] .md pre.code { background: #f4f4f4; color: #171717; border-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .md a,
html[data-theme="light"] .md blockquote { color: #171717; }
html[data-theme="light"] .md blockquote { border-left-color: rgba(0, 0, 0, 0.2); }
html[data-theme="light"] .code-copy { background: #e6e6e6; color: #171717; }
html[data-theme="light"] .admin-nav { border-right-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .admin-nav button.on,
html[data-theme="light"] .admin-nav button:hover { background: #f2f2f2; color: #171717; }
html[data-theme="light"] .menu-pop,
html[data-theme="light"] .composer-menu,
html[data-theme="light"] #conv-menu,
html[data-theme="light"] #ratio-pop,
html[data-theme="light"] #plus-pop,
html[data-theme="light"] #mention-pop,
html[data-theme="light"] #video-opts-pop,
html[data-theme="light"] #preset-pop,
html[data-theme="light"] #more-pop,
html[data-theme="light"] #viewer-more-pop,
html[data-theme="light"] .group-list button,
html[data-theme="light"] .card,
html[data-theme="light"] .stat,
html[data-theme="light"] .alert { background: #fff; color: #171717; border-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] #conv-menu button:hover,
html[data-theme="light"] .composer-menu button:hover,
html[data-theme="light"] .group-list button:hover { background: #f2f2f2; color: #171717; }
html[data-theme="light"] .legal,
html[data-theme="light"] .legal b,
html[data-theme="light"] .side-foot,
html[data-theme="light"] .side-foot b,
html[data-theme="light"] .side-foot span { color: #6b6b6b; }
html[data-theme="light"] .viewer-actions > button { background: #f2f2f2; color: #171717; }
html[data-theme="light"] .viewer-actions > button.share { background: #171717; color: #fff; }
html[data-theme="light"] .viewer-actions > button.share svg { stroke: #fff; }
html[data-theme="light"] .lib-bulk { background: #f4f4f4; color: #171717; }
html[data-theme="light"] .lib-bulk button { background: #e7e7e7; color: #171717; }
html[data-theme="light"] .side-search input,
html[data-theme="light"] #composer textarea,
html[data-theme="light"] .composer textarea { color: #171717; }
html[data-theme="light"] #composer textarea::placeholder,
html[data-theme="light"] .composer textarea::placeholder { color: #8a8a8a; }
html[data-theme="light"] .top { border-bottom-color: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .user-pop #logout-btn { border-top-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] #voice-type.voice-panel textarea,
html[data-theme="light"] #voice-type.voice-panel select,
html[data-theme="light"] #voice-type.voice-panel .stt-lang {
  background: #fff;
  color: #171717;
  border-color: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .vs-label,
html[data-theme="light"] #voice-speed-label,
html[data-theme="light"] #mic-gain-label,
html[data-theme="light"] .vs-level,
html[data-theme="light"] .pref-field,
html[data-theme="light"] .pref-note { color: #5c5c5c; }
html[data-theme="light"] .usage-row { border-bottom-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .msg-actions button { color: rgba(0, 0, 0, 0.45); }
html[data-theme="light"] .msg-actions button:hover { background: rgba(0, 0, 0, 0.06); color: #171717; }
html[data-theme="light"] .msg-actions button.selected { background: rgba(0, 0, 0, 0.1); color: #171717; }
html[data-theme="light"] .msg.pending .md::after,
html[data-theme="light"] .msg.pending:not(:has(.md))::after { color: #171717; }
html[data-theme="light"] .toast { background: #171717; color: #fff; }
html[data-theme="light"] .ref-chip { background: #ececec; color: #171717; }
html[data-theme="light"] .frame { background: #f6f6f6; }
html[data-theme="light"] #voice-view {
  background:
    radial-gradient(1000px 560px at 50% 8%, rgba(80, 110, 180, 0.08), transparent 62%),
    #fff;
  color: #171717;
}
html[data-theme="light"] .mode-group button[data-kind="image"].on { color: #171717; }
html[data-theme="light"] #audio-btn.on,
html[data-theme="light"] #mic-btn,
html[data-theme="light"] .composer .icon-btn,
html[data-theme="light"] .chat-bar .icon-btn { color: #171717; }
html[data-theme="light"] .orb { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 24px 60px rgba(0, 0, 0, 0.12); }

/* Voix : cercle au centre, saisie identique au chat. Les réglages sont dans Paramètres. */
#voice-view .voice-stage {
  justify-content: flex-start;
  gap: 8px;
  padding-top: 8px;
}
#voice-view .voice-top {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(760px, 100%);
  margin: 0 auto;
  font-size: 17px;
  font-weight: 600;
}
#voice-view .voice-top .back-btn { color: inherit; }
#voice-view .voice-hero {
  flex: 1 1 auto;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}
#voice-view .orb { --orb-size: clamp(180px, 36vh, 300px); }
#voice-view.live .orb {
  --orb-size: clamp(210px, 42vh, 340px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 0 80px rgba(120, 150, 220, 0.28),
    0 28px 70px rgba(0, 0, 0, 0.55);
}
/* Transcript : hauteur garantie, il ne peut plus être écrasé par le hero */
#voice-view .transcript {
  flex: 0 0 auto;
  width: min(760px, calc(100% - 28px));
  height: min(22vh, 200px);
  min-height: 96px;
  max-height: min(22vh, 200px);
}
#voice-type.voice-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  width: min(760px, calc(100% - 28px));
  max-height: none;
  margin: 0 auto 10px;
  overflow: visible;
  background: #202020;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 14px 14px 10px;
  box-shadow: none;
  gap: 8px;
}
#voice-type.voice-composer textarea,
#voice-type.voice-composer .attachment-list,
#voice-type.voice-composer .voice-type-bar { grid-column: 1 / -1; }
#voice-type.voice-composer textarea {
  width: 100%;
  max-height: 160px;
  padding: 6px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 16px;
}
#voice-type.voice-composer textarea::placeholder { color: #8d8d8d; }
#voice-type.voice-composer .voice-type-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  min-width: 0;
  flex-wrap: nowrap;
}
#voice-type.voice-composer .plus-btn,
#voice-type.voice-composer .talk-btn {
  width: auto;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: #eee;
  font-weight: 500;
}
#voice-type.voice-composer .plus-btn { width: 36px; padding: 0; font-size: 22px; font-weight: 400; }
#voice-type.voice-composer .talk-btn { display: inline-flex; align-items: center; gap: 6px; }
#voice-type.voice-composer .talk-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
#voice-type.voice-composer .talk-btn.on {
  background: #fff;
  color: #111;
}
#voice-type.voice-composer .talk-btn.muted { background: #3a1d1d; color: #ffb4ae; }
#voice-type.voice-composer #voice-send {
  width: 36px;
  height: 36px;
  margin-left: auto;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
}
#voice-type.voice-composer #voice-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #111;
  stroke-width: 1.8;
}
#chat-talk { flex: none; }
#chat-talk svg { width: 16px; height: 16px; }
.voice-settings select,
.voice-settings textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #101010;
  color: #f3f3f3;
}
.voice-settings .vs-toggles { display: grid; gap: 8px; }
.voice-settings .vs-toggles button,
.voice-settings #agent-save,
.voice-settings #lecon-record {
  width: auto;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #f3f3f3;
  justify-self: start;
}
.voice-settings #agent-save { background: #fff; color: #111; border-color: #fff; }
.voice-settings .vs-agent-row button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.voice-settings .mic-mute-btn.muted { background: #3a1d1d; color: #ffb4ae; border-color: transparent; }
@media (max-width: 640px) {
  #voice-view .orb { --orb-size: clamp(150px, 32vh, 220px); }
  #voice-view.live .orb { --orb-size: clamp(168px, 36vh, 240px); }
  #chat-talk span { display: none; }
}
html[data-theme="light"] #voice-type.voice-composer {
  background: #f4f4f4;
  color: #171717;
  border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] #voice-type.voice-composer textarea { color: #171717; }
html[data-theme="light"] #voice-type.voice-composer .talk-btn,
html[data-theme="light"] #voice-type.voice-composer .plus-btn,
html[data-theme="light"] #chat-talk { color: #171717; }
html[data-theme="light"] .voice-settings select,
html[data-theme="light"] .voice-settings textarea {
  background: #fff;
  color: #171717;
  border-color: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .voice-settings .vs-toggles button,
html[data-theme="light"] .voice-settings .vs-agent-row button,
html[data-theme="light"] .voice-settings #lecon-record { color: #171717; }

/* Panneau Voix et style, ouvert depuis l’icône du chat */
.agent-pop {
  position: fixed;
  z-index: 18;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px));
  max-height: min(68vh, 560px);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 14px 14px 16px;
  border-radius: 20px;
  background: #1c1c1c;
  color: #f3f3f3;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}
.agent-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-pop-head strong { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.agent-pop-head button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #eee;
  font-size: 18px;
  line-height: 1;
}
.agent-pop-head button:hover { background: #2a2a2a; }
.agent-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-chip {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #f2f2f2;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}
.agent-chip.on,
.agent-chip:hover { background: #fff; color: #111; border-color: #fff; }
.agent-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.agent-pop .pref-field { color: #b5b5b5; }
.agent-pop textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #101010;
  color: #f3f3f3;
}
.agent-pop .vs-agent-row { justify-content: flex-end; }
.agent-pop .vs-agent-row button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eee;
}
.agent-pop .vs-agent-row button:hover { background: #2a2a2a; }
.agent-pop .vs-save {
  justify-self: end;
  width: auto;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-weight: 600;
}
.agent-pop [data-speaker-toggle] {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: left;
  color: #f2f2f2;
  background: transparent;
}
.agent-pop [data-speaker-toggle]:hover,
.agent-pop [data-speaker-toggle][aria-pressed="true"] { background: #2a2a2a; }
[data-agent-toggle].on { background: #2a2a2a; }
#voice-type.voice-composer [data-agent-toggle] {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #eee;
  display: grid;
  place-items: center;
}
#voice-type.voice-composer [data-agent-toggle].on { background: #2a2a2a; color: #fff; }
html[data-theme="light"] .agent-pop {
  background: #fff;
  color: #171717;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .agent-pop textarea {
  background: #f6f6f6;
  color: #171717;
  border-color: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .agent-chip {
  color: #171717;
  border-color: rgba(0, 0, 0, 0.14);
}
html[data-theme="light"] .agent-chip.on,
html[data-theme="light"] .agent-chip:hover { background: #171717; color: #fff; border-color: #171717; }
html[data-theme="light"] .agent-pop [data-speaker-toggle],
html[data-theme="light"] .agent-pop .vs-agent-row button,
html[data-theme="light"] .agent-pop-head button,
html[data-theme="light"] #voice-type.voice-composer [data-agent-toggle] { color: #171717; }
html[data-theme="light"] [data-agent-toggle].on,
html[data-theme="light"] .agent-pop [data-speaker-toggle]:hover,
html[data-theme="light"] .agent-pop [data-speaker-toggle][aria-pressed="true"],
html[data-theme="light"] .agent-pop-head button:hover { background: #ececec; color: #171717; }

/* Quatre cartes par ligne, sans défilement horizontal. */
.imagine-feed { min-width: 0; }
.imagine.feed .feed-scroll {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}
.imagine.feed .feed-grid {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 14px;
  overflow: hidden;
  padding: 4px 0 12px;
}
.feed-grid > .feed-card {
  position: relative;
  flex: 0 0 calc((100% - 24px) / 4);
  width: calc((100% - 24px) / 4);
  max-width: calc((100% - 24px) / 4);
  min-width: 0;
  height: auto;
  aspect-ratio: 3 / 4;
  max-height: 56vh;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #111;
}
.feed-grid .feed-card img,
.feed-grid .feed-card video {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: #000;
}
.feed-grid > .feed-card.gen-card {
  aspect-ratio: 3 / 4;
  width: calc((100% - 24px) / 4);
  height: auto;
  max-height: 56vh;
}
@media (max-width: 960px) {
  .feed-grid > .feed-card,
  .feed-grid > .feed-card.gen-card {
    flex: 0 0 calc((100% - 8px) / 2);
    width: calc((100% - 8px) / 2);
    max-width: calc((100% - 8px) / 2);
    max-height: none;
  }
}

/* Connexion / inscription */
.gate-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #1a1a1a;
}
.gate-tabs button {
  border-radius: 999px;
  padding: 9px 12px;
  background: transparent;
  color: #cfcfcf;
  font-weight: 600;
}
.gate-tabs button.on { background: #fff; color: #111; }
.gate-form { display: grid; gap: 14px; }

/* Compte : menu latéral comme la capture */
.account-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100%;
}
.account-nav {
  padding: 28px 14px;
  display: grid;
  align-content: start;
  gap: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.account-nav p {
  margin: 0 10px 8px;
  color: #8d8d8d;
  font-size: 13px;
}
.account-nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: inherit;
  font-weight: 500;
}
.account-nav button svg,
.theme-row button svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.account-nav button.on { background: #2a2a2a; }
.account-main.pref {
  width: min(720px, 100%);
  margin: 0;
  padding: 28px 32px 56px;
}
@media (max-width: 800px) {
  .account-shell { grid-template-columns: 1fr; }
  .account-nav { border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding: 16px 12px 8px; }
  .account-main.pref { padding: 16px 16px 40px; }
}

/* Bibliothèque : onglets et légendes */
.lib-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  max-width: 280px;
  flex: 1;
  background: #1c1c1c;
  border-radius: 999px;
  padding: 0 12px;
}
.lib-search svg { width: 16px; height: 16px; fill: none; stroke: #aaa; stroke-width: 1.7; flex: 0 0 auto; }
.lib-search input {
  border: 0;
  background: transparent;
  padding: 8px 0;
  color: inherit;
}
.lib-when {
  margin: 2px 16px 8px;
  font-weight: 650;
  color: #ececec;
}
.lib-grid { gap: 14px 12px; padding: 0 12px 88px; }
.lib-card { min-width: 0; display: grid; align-content: start; gap: 6px; cursor: pointer; }
.lib-card .lib-tile { border-radius: 12px; }
.lib-caption { display: grid; gap: 2px; min-width: 0; padding: 0 2px; }
.lib-caption strong {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-caption span { font-size: 12px; color: #9a9a9a; }
.lib-empty { grid-column: 1 / -1; margin: 8px; color: #9a9a9a; }
.lib-filters button { background: transparent; color: #bdbdbd; }
.lib-filters button.on { background: #2a2a2a; color: #fff; }

/* Voix et personnalité : listes déroulantes */
.agent-pop { width: min(360px, calc(100vw - 24px)); }
.agent-pop select {
  background: #2a2a2a;
  color: #f4f4f4;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 14px;
}
.agent-instructions {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.agent-pop input[type="range"] { accent-color: #fff; }

html[data-theme="light"] .gate { background: #f6f6f4; }
html[data-theme="light"] .gate-tabs { background: #ececec; }
html[data-theme="light"] .gate-tabs button { color: #333; }
html[data-theme="light"] .gate-tabs button.on { background: #fff; color: #111; }
html[data-theme="light"] .account-nav { border-right-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .account-nav button.on { background: #ececec; color: #111; }
html[data-theme="light"] .lib-search { background: #fff; border: 1px solid rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .lib-when,
html[data-theme="light"] .lib-caption strong { color: #171717; }
html[data-theme="light"] .lib-filters button { background: transparent; color: #444; }
html[data-theme="light"] .lib-filters button.on { background: #ececec; color: #111; }
html[data-theme="light"] .agent-pop select { background: #f3f3f3; color: #171717; border-color: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .agent-instructions { border-color: rgba(0, 0, 0, 0.08); }

/* ============================================================
   Orb vocal : on ne garde que le bot, plus aucun cercle autour.
   Neutralise le fond radial, l'anneau (box-shadow), la lueur live,
   le SVG .orb-ring et les pseudo-elements ::before / ::after.
   ============================================================ */
#voice-view .orb,
#voice-view.live .orb,
html[data-theme="light"] #voice-view .orb,
html[data-theme="light"] #voice-view.live .orb {
  background: none;
  background-image: none;
  border-radius: 0;
  box-shadow: none;
}
#voice-view .orb::before,
#voice-view .orb::after,
#voice-view .orb.listen::after,
#voice-view .orb.think::after,
#voice-view .orb.speak::after {
  content: none;
  border: 0;
  background: none;
  box-shadow: none;
  animation: none;
}
#voice-view .orb .orb-ring { display: none; }
/* Le bot occupe le bouton (il ne representait que 46% quand le disque le cadrait) */
#voice-view .orb .am-bot-orb {
  width: 82%;
  height: 90%;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.55));
}
#voice-view .orb:focus-visible { outline: 2px solid rgba(160, 190, 255, 0.85); outline-offset: 10px; }

/* ============================================================
   Orb vocal Aminai — cercle bleu animé, sans visage.
   Structure : .orb-glow (halo), .orb-ball (sphère bleue de repli),
   .orb-wave (canvas : silhouette déformée par le moteur vocal).
   Les états sont posés sur [data-voice-state] : idle, listening,
   processing, speaking + marqueurs .muted / .interrupted / .error.
   ============================================================ */
#voice-view .orb {
  --orb-size: clamp(200px, 34vh, 320px);
  position: relative;
  width: var(--orb-size);
  height: var(--orb-size);
  isolation: isolate;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
#voice-view .orb:active { transform: scale(0.97); }

#voice-view .orb-glow {
  position: absolute;
  inset: -16%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(80, 140, 255, 0.42) 0%, rgba(50, 90, 200, 0.14) 46%, transparent 72%);
  filter: blur(24px);
  opacity: 0.42;
  transform: scale(0.97);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}
#voice-view .orb[data-voice-state="listening"] .orb-glow { opacity: 0.72; transform: scale(1.02); }
#voice-view .orb[data-voice-state="processing"] .orb-glow { opacity: 0.62; transform: scale(1.0); }
#voice-view .orb[data-voice-state="speaking"] .orb-glow { opacity: 0.9; transform: scale(1.06); }
#voice-view .orb.muted .orb-glow { opacity: 0.10; transform: scale(0.92); }
html[data-theme="light"] #voice-view .orb-glow {
  background: radial-gradient(circle, rgba(60, 120, 255, 0.30) 0%, rgba(60, 110, 220, 0.10) 46%, transparent 72%);
}

#voice-view .orb-ball {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 36% 28%, #dbe9ff 0%, #7fb2ff 24%, #2e66f5 62%, #0b2b85 100%);
  box-shadow:
    inset 0 0 40px rgba(255, 255, 255, 0.16),
    0 26px 70px rgba(10, 30, 90, 0.45);
  /* Déformée par le moteur (transform écrit en JS, transform numérique lissé) */
  transform-origin: 50% 50%;
  transition: filter 0.5s ease, opacity 0.5s ease;
}
#voice-view .orb .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(20px);
  mix-blend-mode: screen;
  opacity: 0.85;
}
#voice-view .orb .blob.red {
  width: 76%; height: 76%; top: -14%; left: -12%;
  background: radial-gradient(circle at 45% 45%, #cfe3ff 0%, #6ea8ff 36%, #1c46b8 70%, transparent 100%);
  animation: drift-a 7s ease-in-out infinite;
}
#voice-view .orb .blob.green {
  width: 64%; height: 64%; right: -12%; bottom: -10%;
  background: radial-gradient(circle at 55% 55%, #e6e2ff 0%, #7f9dff 36%, #123a9e 70%, transparent 100%);
  animation: drift-b 8.5s ease-in-out infinite;
}
#voice-view .orb .blob.white {
  width: 46%; height: 46%; top: 22%; left: 28%;
  background: radial-gradient(circle at 42% 34%, #ffffff 0%, #dfecff 36%, #9cc0ff 66%, transparent 100%);
  animation: drift-c 5.5s ease-in-out infinite;
}
#voice-view[data-voice-state="processing"] .orb .blob.white { animation-duration: 1.4s; }
#voice-view[data-voice-state="speaking"] .orb .blob { animation-duration: 1.6s; }
#voice-view .orb .shine {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.04) 32%, transparent 52%),
    radial-gradient(circle at 68% 82%, rgba(4, 20, 70, 0.35), transparent 46%);
}

#voice-view .orb-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Micro coupé : cercle calme, gris-bleu, clairement inactif. */
#voice-view .orb.muted .orb-ball,
#voice-view .orb.muted .blob {
  filter: saturate(0.35) brightness(0.72);
}
#voice-view .orb.muted .orb-wave { opacity: 0.25; }

/* Marqueurs brefs */
#voice-view .orb.interrupted .orb-ball { box-shadow: inset 0 0 40px rgba(255,255,255,0.16), 0 0 0 2px rgba(255, 255, 255, 0.55), 0 0 44px rgba(255, 255, 255, 0.4); }
#voice-view .orb.error .orb-ball { box-shadow: inset 0 0 40px rgba(255,255,255,0.16), 0 0 0 2px rgba(255, 122, 122, 0.75), 0 0 44px rgba(255, 90, 90, 0.35); }

/* Porte d'activation unique (si le navigateur exige un geste) */
#voice-view #voice-activation {
  margin: 2px 0 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}
#voice-view #voice-activation > p {
  margin: 0;
  font-size: 12.5px;
  color: #9aa7c0;
  max-width: 42ch;
}
#voice-view #voice-activation button {
  border: 0;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(180deg, #3d74ff, #1f47c9);
  box-shadow: 0 6px 22px rgba(40, 90, 220, 0.45);
  cursor: pointer;
}
#voice-view #voice-activation button:active { transform: scale(0.97); }
html[data-theme="light"] #voice-view #voice-activation > p { color: #5a6a88; }

/* Respect de la préférence « réduire les animations » : le canvas
   s'immobilise côté JS et seul un dégradé statique demeure. */
@media (prefers-reduced-motion: reduce) {
  #voice-view .orb .blob,
  #voice-view .orb-glow {
    animation: none !important;
    transition: none !important;
  }
  #voice-view .orb-wave { display: none; }
  #voice-view .orb, #voice-view .orb-glow { transform: none !important; }
}
html[data-theme="light"] #voice-view .orb-wave { mix-blend-mode: normal; opacity: 0.92; }


/* Pièces générées par l'agent (images et fichiers) */
.msg-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.msg-attachment-image {
  display: block;
  width: min(380px, 100%);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #121212;
}
.msg-attachment-image img {
  display: block;
  width: 100%;
  height: auto;
}
.msg-attachment-file {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(430px, 100%);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #171717;
  color: #f3f3f3;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.msg-attachment-file:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: #1d1d1d;
}
.msg-attachment-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.msg-attachment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.msg-attachment-meta strong {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-attachment-meta small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}
#transcript .msg-attachments { flex: 0 0 100%; }
#transcript .msg-attachment-image { width: min(320px, 100%); }

.msg-attachment-video {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(460px, 100%);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #171717;
  color: #f3f3f3;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.msg-attachment-video:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: #1d1d1d;
}
.msg-attachment-video img {
  flex: none;
  width: 72px;
  height: 92px;
  object-fit: cover;
  border-radius: 9px;
  background: #0b0b0b;
}
.msg-attachment-video .msg-attachment-meta strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}
#transcript .msg-attachment-video { flex: 0 0 100%; width: min(360px, 100%); }
