/* ═══════════════════════════════════════════════════════════
   CORTEX AI — STYLES  (interface façon Gemini, thème sombre)
   ═══════════════════════════════════════════════════════════ */

/* ── Variables & Reset ──────────────────────────────────────── */
:root {
  --bg:            #101113;
  --glow:          rgba(66, 133, 244, 0.14);
  --surface:       #1e2022;
  --pill:          #242628;
  --pill-border:   #303236;
  --user-bubble:   #29292b;
  --text:          #e3e3e3;
  --muted:         #9aa0a6;
  --accent:        #8ab4f8;
  --accent-ink:    #101113;
  --error:         #f28b82;
  --radius-pill:   28px;
  --font:          'Google Sans Text', -apple-system, BlinkMacSystemFont,
                   'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* Halo bleu central — uniquement sur l'accueil */
body:not(.chat-mode)::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(52rem 32rem at 50% 46%, var(--glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════
   POPUP — Saisie du prénom (même style que l'accueil)
   ═══════════════════════════════════════════════════════════ */
#name-popup {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(52rem 32rem at 50% 46%, var(--glow), transparent 70%),
    var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}

#name-popup.visible { opacity: 1; pointer-events: all; }

.popup-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .95rem;
  width: min(26rem, 92vw);
  animation: popIn .45s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes popIn {
  from { transform: scale(.92) translateY(14px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

.popup-logo { width: 56px; height: 56px; object-fit: contain; }

.popup-inner h1 {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
}

.popup-inner p {
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

.popup-pill {
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 100%;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-pill);
  padding: .35rem .35rem .35rem 1.3rem;
  transition: border-color .2s, box-shadow .2s;
}

.popup-pill:focus-within {
  border-color: rgba(138, 180, 248, .55);
  box-shadow: 0 0 0 3px rgba(138, 180, 248, .12);
}

#name-input,
#rename-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: .65rem 0;
}

#name-input::placeholder,
#rename-input::placeholder { color: var(--muted); }

#name-input.shake { animation: shake .35s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

#name-submit {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s, opacity .2s;
}

#name-submit:hover { transform: scale(1.06); }

#name-error {
  color: var(--error);
  font-size: .82rem;
  min-height: 1.1rem;
}

/* ═══════════════════════════════════════════════════════════
   BARRE HAUTE
   ═══════════════════════════════════════════════════════════ */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.15rem;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.brand-logo { width: 26px; height: 26px; object-fit: contain; }

.brand-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--text);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--pill-border);
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.avatar:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   SCÈNE — accueil centré / conversation
   ═══════════════════════════════════════════════════════════ */
#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  z-index: 1;
}

#stage.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -10px;
}

/* ── Accueil : titre centré, juste au-dessus de la pilule ── */
#home {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: calc(46vh + 96px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  padding: 0 1.2rem;
}

body:not(.chat-mode) #home { display: flex; }

#greeting {
  font-size: clamp(2rem, 5.4vw, 2.75rem);
  font-weight: 400;
  letter-spacing: .2px;
  color: var(--text);
}

/* ── Conversation ──────────────────────────────────────────── */
#chat {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body.chat-mode #chat { display: block; }

#chat::-webkit-scrollbar       { width: 8px; }
#chat::-webkit-scrollbar-track { background: transparent; }
#chat::-webkit-scrollbar-thumb { background: #2a2c2e; border-radius: 8px; }

#messages {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.6rem 1.25rem 11rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.msg {
  display: flex;
  animation: msgIn .3s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Message utilisateur : pilule sombre à droite */
.msg.user { justify-content: flex-end; }

.user-bubble {
  background: var(--user-bubble);
  border-radius: 1.5rem;
  padding: .72rem 1.3rem;
  max-width: min(70%, 34rem);
  font-size: .95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.user-bubble .msg-image {
  display: block;
  max-width: 16rem;
  max-height: 14rem;
  border-radius: .9rem;
  object-fit: cover;
  margin-bottom: .45rem;
  cursor: pointer;
}

.img-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface);
  border-radius: .7rem;
  padding: .35rem .6rem;
  font-size: .8rem;
  color: var(--muted);
}

/* Message assistant : texte nu, pleine largeur */
.assistant-block {
  width: 100%;
  max-width: 44rem;
}

.assistant-text {
  font-size: .98rem;
  line-height: 1.75;
  word-break: break-word;
}

.assistant-text strong { font-weight: 600; }
.assistant-text em     { font-style: italic; }

.assistant-text code {
  background: var(--surface);
  padding: .12rem .42rem;
  border-radius: .35rem;
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: .86em;
}

/* Curseur de frappe pendant la génération */
.msg.streaming .assistant-text::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  background: var(--text);
  vertical-align: text-bottom;
  animation: blink .9s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ── Actions sous la réponse : copier + régénérer seulement ── */
.msg-actions {
  display: flex;
  gap: .15rem;
  margin-top: .55rem;
}

.msg.streaming .msg-actions { visibility: hidden; }

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.action-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.action-btn.ok { color: var(--accent); }

/* ── Indicateur de génération : « Thinking... » + shine ────── */
.thinking {
  display: inline-flex;
  align-items: center;
  padding: .35rem 0;
  font-size: .98rem;
  font-weight: 500;
}

/* Dégradé animé qui balaie le texte, façon ChatGPT */
.thinking-text,
.thinking-dots i {
  background: linear-gradient(90deg,
      var(--muted) 0%,  var(--muted) 35%,
      #f4f6f8      50%,
      var(--muted) 65%, var(--muted) 100%);
  background-size: 220% 100%;
  animation: shine 1.9s linear infinite;
}

.thinking-text {
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Les points de « Thinking... » se soulèvent */
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  height: 12px;
}

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  animation: shine 1.9s linear infinite,
             dotLift 1.2s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) { animation-delay: .15s, .15s; }
.thinking-dots i:nth-child(3) { animation-delay: .30s, .30s; }

@keyframes shine {
  from { background-position: 220% 0; }
  to   { background-position: -120% 0; }
}

@keyframes dotLift {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* ═══════════════════════════════════════════════════════════
   PILULE DE SAISIE — centrée à l'accueil, ancrée en discussion
   ═══════════════════════════════════════════════════════════ */
#input-dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: min(43.5rem, 92vw);
  bottom: 46vh;
  transition: bottom .45s cubic-bezier(.4, 0, .2, 1),
              width  .45s cubic-bezier(.4, 0, .2, 1);
}

body.chat-mode #input-dock {
  bottom: 1.1rem;
  width: min(56rem, 94vw);
}

/* Aperçu des images en attente (5 max) */
#image-preview {
  display: none;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .55rem;
}

#image-preview.has-items { display: flex; }

.preview-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  border-radius: .9rem;
  padding: .35rem .45rem;
  animation: msgIn .25s ease;
}

.preview-chip img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: .55rem;
}

.preview-chip .preview-name {
  max-width: 9rem;
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-chip button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .95rem;
  cursor: pointer;
  line-height: 1;
  padding: .25rem;
  border-radius: 50%;
  transition: color .15s;
}

.preview-chip button:hover { color: var(--error); }

/* La pilule */
.input-pill {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
  background: var(--pill);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: .45rem .5rem .45rem .55rem;
  transition: border-color .2s, box-shadow .2s;
}

.input-pill:focus-within {
  border-color: rgba(138, 180, 248, .55);
  box-shadow: 0 0 0 3px rgba(138, 180, 248, .10);
}

#upload-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}

#upload-btn:hover {
  background: var(--surface);
  color: var(--text);
}

#chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font: inherit;
  font-size: .98rem;
  line-height: 1.5;
  max-height: 12rem;
  padding: .6rem .2rem;
}

#chat-input::placeholder { color: var(--muted); }

#send-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s, background .2s, color .2s;
}

#send-btn:disabled {
  background: var(--surface);
  color: var(--muted);
  cursor: default;
}

#send-btn:hover:not(:disabled) { transform: scale(1.06); }

/* ── Sélecteur de mode (Flash / Pro) — libellés seulement ─── */
.mode-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: flex-end;
}

#mode-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  height: 40px;
  padding: 0 .8rem;
  border: none;
  border-radius: 20px;
  background: none;
  color: var(--text);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}

#mode-btn:hover { background: var(--surface); }

#mode-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 132px;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  border-radius: 12px;
  padding: .35rem;
  display: none;
  flex-direction: column;
  gap: .15rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
  z-index: 20;
}

#mode-menu.open { display: flex; }

.mode-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  border: none;
  background: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: .88rem;
  padding: .5rem .7rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}

.mode-item:hover { background: var(--surface); color: var(--text); }

.mode-item.active { color: var(--text); }

.mode-item.active::after {
  content: '✓';
  color: var(--accent);
  font-size: .8rem;
}

/* ── Menu « + » façon Gemini ───────────────────────────────── */
.plus-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: flex-end;
}

#plus-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  min-width: 232px;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  border-radius: 14px;
  padding: .4rem;
  display: none;
  flex-direction: column;
  gap: .15rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
  z-index: 20;
}

#plus-menu.open { display: flex; }

.menu-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  padding: .6rem .7rem;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}

.menu-item:hover { background: var(--surface); }

.menu-item svg { flex-shrink: 0; color: var(--muted); }

.menu-item.active::after {
  content: '✓';
  margin-left: auto;
  color: var(--accent);
  font-size: .8rem;
}

/* Badge globe visible quand la recherche web est active */
#web-badge {
  display: none;
  align-self: flex-end;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 40px;
  color: var(--accent);
  flex-shrink: 0;
}

#web-badge.on { display: flex; }

/* Mention sous la pilule — visible en conversation seulement */
.input-hint {
  display: none;
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .6rem;
}

body.chat-mode .input-hint { display: block; }

/* ═══════════════════════════════════════════════════════════
   TOAST ERREUR
   ═══════════════════════════════════════════════════════════ */
.toast-error {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--error);
  color: #201a1a;
  padding: .7rem 1.25rem;
  border-radius: 30px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(242, 139, 130, .35);
  z-index: 999;
  animation: toastIn .3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Toast de confirmation (bleu) */
.toast-info {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-ink);
  padding: .7rem 1.25rem;
  border-radius: 30px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(138, 180, 248, .35);
  z-index: 999;
  animation: toastIn .3s ease;
}

/* ═══════════════════════════════════════════════════════════
   POPUP CHANGEMENT DE PRÉNOM
   ═══════════════════════════════════════════════════════════ */
#rename-popup {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 9, 10, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

#rename-popup.visible { opacity: 1; pointer-events: all; }

.rename-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
  width: min(24rem, 92vw);
  background: var(--pill);
  border: 1px solid var(--pill-border);
  border-radius: 20px;
  padding: 2rem 1.6rem 1.6rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
  animation: popIn .4s cubic-bezier(.34, 1.56, .64, 1);
}

.rename-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.rename-card h2 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
}

.rename-card p {
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
  line-height: 1.55;
}

#rename-error {
  color: var(--error);
  font-size: .82rem;
  min-height: 1.1rem;
}

.rename-actions {
  display: flex;
  gap: .6rem;
  width: 100%;
}

.rename-actions button {
  flex: 1;
  padding: .72rem;
  border-radius: 14px;
  font-family: var(--font);
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform .15s, border-color .2s, color .2s, opacity .2s;
}

#rename-cancel {
  background: none;
  border: 1px solid var(--pill-border);
  color: var(--muted);
}

#rename-cancel:hover {
  color: var(--text);
  border-color: var(--muted);
}

#rename-submit {
  background: var(--accent);
  border: none;
  color: var(--accent-ink);
}

#rename-submit:hover:not(:disabled) { transform: translateY(-1px); }

#rename-submit:disabled { opacity: .55; cursor: default; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  #home { bottom: calc(40vh + 96px); }

  #input-dock { bottom: 40vh; width: 94vw; }

  body.chat-mode #input-dock { bottom: .8rem; }

  .user-bubble { max-width: 85%; }

  #messages { padding: 1.1rem .9rem 10rem; }

  .topbar { padding: .7rem .9rem; }

  .input-hint { font-size: .68rem; }
}

/* ── Rendu Markdown des réponses (v2.11) ─────────────────────── */
.assistant-text .md-h1, .assistant-text .md-h2,
.assistant-text .md-h3, .assistant-text .md-h4 {
  margin: .85em 0 .35em; font-weight: 700; line-height: 1.25; color: #eaf2ff;
}
.assistant-text .md-h1 { font-size: 1.35em; }
.assistant-text .md-h2 { font-size: 1.2em; }
.assistant-text .md-h3 { font-size: 1.08em; }
.assistant-text .md-h4 { font-size: 1em; }
.assistant-text .md-hr {
  border: 0; height: 1px; margin: .95em 0;
  background: linear-gradient(90deg, transparent, #3d6ea8, transparent);
}
.assistant-text .md-p { margin: 0 0 .45em; }
.assistant-text .md-ul, .assistant-text .md-ol { margin: .2em 0 .6em; padding-left: 1.35em; }
.assistant-text .md-ul li, .assistant-text .md-ol li { margin: .15em 0; }
.assistant-text .md-quote {
  margin: .5em 0; padding: .35em .8em; border-left: 3px solid #3d6ea8;
  background: rgba(61, 110, 168, .12); border-radius: 0 8px 8px 0; color: #b9c6d8;
}
.assistant-text .md-code {
  background: rgba(120, 160, 220, .16); padding: .1em .35em; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em;
}
.assistant-text .md-pre {
  background: #0d1420; border: 1px solid #24344d; border-radius: 10px;
  padding: .7em .9em; margin: .5em 0; overflow-x: auto;
}
.assistant-text .md-pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em; color: #cfe1ff; white-space: pre;
}
.assistant-text a { color: #6fb3ff; text-decoration: underline; text-underline-offset: 2px; }

/* ── Image générée (v2.12) ───────────────────────────────────── */
.assistant-block .gen-image {
  display: block; max-width: min(420px, 100%); margin: .5em 0 .2em;
  border-radius: 14px; border: 1px solid #24344d; background: #0d1420;
}

/* ── Tableaux markdown + bouton nouvelle conversation (v2.14) ── */
.assistant-text .md-table {
  border-collapse: collapse; margin: .6em 0; width: 100%;
  display: block; overflow-x: auto; font-size: .95em;
}
.assistant-text .md-table th, .assistant-text .md-table td {
  border: 1px solid #2a3b57; padding: .4em .7em;
  text-align: left; vertical-align: top;
}
.assistant-text .md-table th {
  background: rgba(61, 110, 168, .18); color: #eaf2ff; font-weight: 700;
}
.assistant-text .md-table tr:nth-child(even) td { background: rgba(255, 255, 255, .03); }
#new-chat-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-right: 6px; border: 1px solid #2a3b57;
  background: rgba(20, 28, 44, .7); color: #9fb6d4; border-radius: 50%;
  cursor: pointer; transition: all .18s ease; font-size: .8em; font-weight: 700;
}
#new-chat-btn:hover { color: #eaf2ff; border-color: #3d6ea8; background: rgba(61, 110, 168, .25); }
#new-chat-btn.armed {
  color: #ffb4b4; border-color: #a8503d; background: rgba(168, 61, 61, .22);
  width: auto; padding: 0 12px; border-radius: 18px;
}

/* ── Cartes de code : langage, boutons, coloration (v2.15) ───── */
.code-card { border: 1px solid #24344d; border-radius: 12px; margin: .6em 0;
  overflow: hidden; background: #0d1420; }
.code-head { display: flex; justify-content: space-between; align-items: center;
  padding: .35em .7em; background: #16202f; border-bottom: 1px solid #24344d; }
.code-lang { font-size: .72em; letter-spacing: .08em; color: #8fb3e3;
  font-weight: 700; text-transform: uppercase; }
.code-actions { display: flex; gap: .4em; }
.code-btn { border: 1px solid #2a3b57; background: rgba(61,110,168,.15);
  color: #9fb6d4; border-radius: 8px; padding: .15em .6em; font-size: .72em;
  cursor: pointer; transition: all .15s ease; }
.code-btn:hover { color: #eaf2ff; border-color: #3d6ea8; background: rgba(61,110,168,.35); }
.code-card .md-pre { margin: 0; border: 0; border-radius: 0; }
.tok-kw  { color: #ff7b72; }
.tok-str { color: #a5d6ff; }
.tok-cm  { color: #8b949e; font-style: italic; }
.tok-num { color: #79c0ff; }
.tok-tag { color: #7ee787; }
.tok-attr{ color: #d2a8ff; }

/* ── Bouton envoyer → carré « stop » pendant la génération (v2.20) ── */
#send-btn.stopping { position: relative; font-size: 0; opacity: 1;
  pointer-events: auto; cursor: pointer; }
#send-btn.stopping svg, #send-btn.stopping img { visibility: hidden; }
#send-btn.stopping::after { content: ''; position: absolute; inset: 0;
  margin: auto; width: 12px; height: 12px; background: currentColor;
  border-radius: 2px; }

/* ── Tester : le site remplace le code dans la carte (v2.21) ── */
.code-card.testing .md-pre { display: none; }
.code-frame iframe { display: block; width: 100%; height: 420px; border: 0;
  background: #fff; }

/* ── v2.22 : bouton « Nouveau chat » avec libellé, en haut ────── */
#new-chat-btn { width: auto; padding: 0 14px; border-radius: 18px; gap: 7px; }
#new-chat-btn .nc-label { font-size: .78rem; font-weight: 600; }
@media (max-width: 560px) { #new-chat-btn .nc-label { display: none; }
  #new-chat-btn { width: 36px; padding: 0; border-radius: 50%; } }

/* ── v2.23 : cartes noir/gris, boutons icônes, zéro surlignage ── */
.md-pre code, .code-card code { background: transparent !important;
  padding: 0 !important; border-radius: 0 !important; }
.code-card { background: #0b0b0c; border-color: #2c2c2e; }
.code-head { background: #161617; border-bottom-color: #2c2c2e; }
.code-lang { color: #8e8e93; }
.code-btn { background: transparent; border: 0; color: #a1a1a6; padding: 5px;
  border-radius: 7px; display: inline-flex; align-items: center; }
.code-btn:hover { background: #262628; color: #ffffff; border-color: transparent; }
.code-btn svg { width: 15px; height: 15px; display: block; }
#new-chat-btn { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
#new-chat-btn .nc-label { display: none; }

/* ── v2.24 : scrollbar sombre + fonds gris neutres (zéro bleu) ── */
.md-pre { background: #111113; scrollbar-width: thin;
  scrollbar-color: #3f3f42 #141416; }
.md-pre::-webkit-scrollbar { height: 9px; width: 9px; }
.md-pre::-webkit-scrollbar-track { background: #141416; border-radius: 6px; }
.md-pre::-webkit-scrollbar-thumb { background: #3f3f42; border-radius: 6px; }
.md-pre::-webkit-scrollbar-thumb:hover { background: #57575c; }
.code-card { background: #0e0e10; }
.code-card .md-pre { background: #0e0e10; }

/* ── v2.25 : « + » blanc, sans cadre, collé à l'avatar ────────── */
#new-chat-btn { border: 0 !important; background: transparent !important;
  color: #ffffff !important; width: 32px; height: 32px; margin-right: 2px; }
#new-chat-btn:hover { background: rgba(255,255,255,.10) !important; }
#new-chat-btn.armed { color: #ffb4b4 !important; background: transparent !important; }

/* ── v2.27 : actions blanches dimensionnées + « + » à droite ─── */
.action-btn { color: #ffffff; }
.action-btn:hover { color: #ffffff; }
.action-btn svg { width: 15px; height: 15px; display: block; margin: auto; }
#new-chat-btn { margin-left: auto; }

/* ── v2.28 : carte affiche + exports multi-formats ──────────── */
.poster-card { border: 1px solid #2c2c2e; border-radius: 12px;
  overflow: hidden; margin: .6em 0; background: #0e0e10; }
.poster-head { display: flex; align-items: center; gap: .4em;
  padding: .4em .6em; background: #161617; border-bottom: 1px solid #2c2c2e; }
.poster-title { font-size: .72em; letter-spacing: .08em; color: #8e8e93;
  font-weight: 700; margin-right: auto; }
.poster-btn { border: 1px solid #3a3a3d; background: #1d1d1f; color: #e8e8ea;
  border-radius: 7px; padding: .18em .6em; font-size: .72em; font-weight: 600;
  cursor: pointer; }
.poster-btn:hover { background: #2c2c2e; color: #ffffff; }
.poster-view { position: relative; overflow: hidden; background: #ffffff; }
.poster-view iframe { border: 0; display: block; }

/* ── v2.29 : verrous anti-cache & anti-régression ────────────── */
.action-btn { color: #ffffff !important; }
.action-btn svg { width: 15px !important; height: 15px !important; }
.topbar #new-chat-btn { margin-left: auto !important; }
