/* ==========================================================================
   JARVIS · Direction A « Réacteur » — spec : docs/DESIGN.md
   Layout : ≥ 1100 px, 3 colonnes (290 · fluide · 390) + barre de commande ;
   900–1099 px, centre + journal, systèmes en volet ; ≤ 899 px, colonne téléphone
   avec le micro sous le pouce et le journal en plein écran.
   ========================================================================== */
:root {
  color-scheme: dark;

  /* Couleurs (§ 2.1) */
  --bg: #03080D;
  --panel-bg: rgba(6, 22, 33, .66);
  --sheet-bg: rgba(4, 13, 20, .96);
  --line: rgba(92, 225, 255, .18);
  --line-soft: rgba(92, 225, 255, .08);
  --line-step: rgba(92, 225, 255, .12);
  --line-head: rgba(92, 225, 255, .14);
  --line-mid: rgba(92, 225, 255, .25);
  --line-round: rgba(92, 225, 255, .35);
  --line-strong: rgba(92, 225, 255, .45);
  --accent: #5CE1FF;
  --accent-hover: #A6F0FF;
  --accent-tint: rgba(92, 225, 255, .14);
  --accent-wash: rgba(92, 225, 255, .06);
  --accent-ghost-hover: rgba(92, 225, 255, .10);
  --core-light: #E8FBFF;
  --text: #DDF7FF;
  --text-soft: #BFEFFC;
  --text-dim: #A9CCD8;
  --text-muted: #86AFBD;
  --placeholder: #6F95A3;
  --warn: #FFB547;
  --warn-line: rgba(255, 181, 71, .55);
  --warn-wash: rgba(255, 181, 71, .06);
  --on-accent: #03131C;
  --scrim: rgba(3, 8, 13, .72);

  /* Typographie (§ 2.2) */
  --font-ui: 'Oxanium', 'Segoe UI', system-ui, sans-serif;
  --font-data: 'JetBrains Mono', ui-monospace, monospace;

  /* Formes et effets (§ 2.3) */
  --bracket: 14px;
  --grid: 48px;
  --hit: 44px;
  --blur: 6px;
  --glow-ring: drop-shadow(0 0 16px rgba(92, 225, 255, .28));
  --glow-mic: 0 0 0 6px rgba(92, 225, 255, .10), 0 0 32px rgba(92, 225, 255, .55);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --reactor: clamp(220px, calc(100vh - 390px), 420px);
  --hud-bg:
    radial-gradient(ellipse 55% 55% at 50% 40%, rgba(92, 225, 255, .11), rgba(92, 225, 255, 0) 70%),
    repeating-linear-gradient(0deg, rgba(92, 225, 255, .035) 0 1px, transparent 1px var(--grid)),
    repeating-linear-gradient(90deg, rgba(92, 225, 255, .035) 0 1px, transparent 1px var(--grid)),
    var(--bg);

  padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { overflow: hidden; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-data); }
.ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Fond : halo + grille */
body { background: var(--hud-bg); }

/* Panneau HUD : 2 équerres (haut gauche, bas droit) */
.panel {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: var(--bracket);
  height: var(--bracket);
  border: 0 solid var(--accent);
  pointer-events: none;
}
.panel::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.panel::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

/* ---------- Cadre de l'application ---------- */
.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 20px;
  padding: 22px 32px 26px;
}

/* ---------- En-tête ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { width: 34px; height: 34px; flex: none; color: var(--accent); }
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-name { font-size: 20px; font-weight: 600; letter-spacing: .32em; white-space: nowrap; }
.brand-sub { font: 400 11px/1.3 var(--font-data); letter-spacing: .12em; color: var(--text-muted); white-space: nowrap; }
.status-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid var(--line-mid);
  font: 400 12px/1 var(--font-data);
  letter-spacing: .1em;
  color: var(--text-soft);
  white-space: nowrap;
  transition: background .2s;
}
.chip-short { display: none; }
.dot-live { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.top-right { display: flex; align-items: center; gap: 18px; }
.clock { font: 400 13px/1 var(--font-data); letter-spacing: .08em; color: var(--text-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .06em;
}

/* ---------- Zone principale ---------- */
.main { display: grid; grid-template-columns: 290px minmax(0, 1fr) 390px; gap: 28px; min-height: 0; }

/* Colonne gauche */
.side-left { display: flex; flex-direction: column; min-height: 0; }
.side-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-mid) transparent;
}
.sheet-head { display: none; }
.block { display: flex; flex-direction: column; gap: 10px; }
.block-skills { gap: 12px; }
.label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .22em; color: var(--accent); text-transform: uppercase; }
.systems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; font-size: 14px; }
.system, .memory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-inline: -8px;
  padding: 7px 8px;
  transition: background .6s ease;
}
.system { border-bottom: 1px solid var(--line-soft); }
.system:last-child { border-bottom: 0; }
.system-name { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.system-dot { flex: none; width: 6px; height: 6px; background: var(--accent); }
.system-meta { flex: none; font: 400 11px/1 var(--font-data); color: var(--text-muted); white-space: nowrap; }
.is-warn .system-dot { background: var(--warn); }
.is-warn .system-meta { color: var(--warn); }
.is-busy .system-dot { animation: blink 1.2s steps(2, start) infinite; }
.is-busy .system-meta { color: var(--accent); }
.is-flash { background: var(--accent-ghost-hover); transition: none; }
.memory-row { font-size: 14px; }
.voice-pick { display: flex; gap: 8px; }
.voice-pick select {
  flex: 1;
  min-width: 0;
  height: var(--hit);
  padding: 0 10px;
  border: 1px solid var(--line-mid);
  border-radius: 0;
  background: rgba(3, 8, 13, .5);
  font: 400 13px/1 var(--font-ui);
  color: var(--text);
}
.voice-pick select:focus { outline: none; border-color: var(--accent); }
.voice-try { flex: none; width: var(--hit); padding: 0; display: grid; place-items: center; }
.block-note { margin: 0; font: 400 11px/1.4 var(--font-data); letter-spacing: .04em; color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.chip { padding: 6px 10px; border: 1px solid var(--line-mid); color: var(--text-dim); transition: border-color .3s, background .3s, color .3s; }
.chip.is-active { border-color: var(--accent); background: var(--accent-tint); color: var(--text); }
.chip-more { position: relative; font: 400 11px/1 var(--font-data); letter-spacing: .1em; color: var(--text-muted); transition: background .2s; }
.chip-more::after { content: ""; position: absolute; inset: -7px -4px; }
.chip-more:hover { background: var(--accent-ghost-hover); color: var(--text); }

/* ---------- Centre : réacteur ---------- */
.center {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.reactor { position: relative; flex: none; width: var(--reactor); max-width: 100%; aspect-ratio: 1 / 1; color: var(--accent); }
.rx { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; will-change: transform; }
.rx-ring { filter: var(--glow-ring); }
.rx-core { will-change: transform, opacity; opacity: 0; }
.rx-glow {
  position: absolute;
  inset: -16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92, 225, 255, .26) 0%, rgba(92, 225, 255, .09) 38%, rgba(92, 225, 255, 0) 66%);
  opacity: 0;
  will-change: transform, opacity;
  pointer-events: none;
}
.reactor-tag { position: absolute; top: 4px; font: 400 11px/1 var(--font-data); letter-spacing: .14em; color: var(--text-muted); white-space: nowrap; }
.reactor-tag.left { left: -8px; }
.reactor-tag.right { right: -8px; text-align: right; }

.voice { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 40px; }
.wave span { display: block; width: 3px; height: 36px; border-radius: 2px; background: var(--accent); opacity: .9; transform: scaleY(.1); }
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 14px;
  font: 400 12px/1 var(--font-data);
  letter-spacing: .2em;
  color: var(--accent);
  text-transform: uppercase;
  transition: color .3s;
}
.status .blink { width: 7px; height: 7px; background: currentColor; }
.app[data-state="awaiting"] .status, .app[data-state="error"] .status { color: var(--warn); }
.blink { animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.transcript {
  margin: 0;
  max-width: 560px;
  min-height: 2.8em;
  text-align: center;
  font-size: 22px;
  font-weight: 300;
  line-height: 1.4;
  text-wrap: balance;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.transcript.is-hint { color: var(--text-dim); }
.transcript .interim { color: var(--text-dim); }

/* ---------- Colonne droite : journal de mission ---------- */
.side-right { display: flex; flex-direction: column; min-height: 0; }
.journal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line-head); }
.journal-title { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.journal-title .label { flex: none; white-space: nowrap; }
.journal-title .mono { min-width: 0; overflow: hidden; font-size: 11px; letter-spacing: .08em; color: var(--text-muted); white-space: nowrap; text-overflow: ellipsis; }
.journal {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-mid) transparent;
}
.close {
  flex: none;
  width: var(--hit);
  height: var(--hit);
  display: none;
  place-items: center;
  border: 1px solid var(--line-round);
  border-radius: 50%;
  transition: background .2s;
}
.close:hover { background: var(--accent-ghost-hover); }

.msg { display: flex; flex-direction: column; gap: 6px; animation: appear .35s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }
.msg-meta { font: 400 11px/1.3 var(--font-data); letter-spacing: .14em; color: var(--text-muted); }
.msg.is-jarvis .msg-meta { color: var(--accent); }
.msg-text.is-pending { color: var(--text-dim); }
.msg.is-claude .msg-meta { color: var(--accent); }
.msg.is-claude .msg-text { padding: 12px 14px; border: 1px solid var(--line-step); background: var(--accent-wash); }
.msg-text { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-text p, .msg-text ul, .msg-text blockquote { margin: 0 0 .6em; }
.msg-text > :last-child { margin-bottom: 0; }
.msg-text ul { list-style: none; padding: 0; }
.msg-text li { position: relative; padding-left: 1.2em; }
.msg-text li::before { content: ""; position: absolute; left: 1px; top: .75em; width: 7px; height: 1px; background: var(--accent); }
.msg-text strong { font-weight: 600; color: var(--core-light); }
.msg-text code { padding: .1em .35em; background: var(--accent-tint); font: .86em var(--font-data); }
.msg-text blockquote { padding: 10px 12px; border: 1px solid var(--line-step); color: var(--text-dim); }
.caret { display: inline-block; width: .45em; height: 1em; margin-left: 3px; vertical-align: -.12em; background: var(--accent); animation: blink 1s steps(2, start) infinite; }

/* Étapes */
.steps {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border: 1px solid var(--line-step);
  font-size: 13px;
  animation: appear .35s ease both;
}
.step { display: grid; grid-template-columns: 18px 92px minmax(0, 1fr); gap: 8px; align-items: baseline; animation: appear .3s ease both; }
.step-icon { width: 14px; height: 14px; align-self: center; display: grid; place-items: center; color: var(--accent); }
.step-icon svg { width: 14px; height: 14px; }
.step-tool { font: 400 11px/1.4 var(--font-data); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-label { overflow-wrap: anywhere; line-height: 1.4; }
.step[data-status="running"] .step-label { color: var(--text-dim); }
.step[data-status="running"] .step-icon::before,
.step[data-status="waiting"] .step-icon::before {
  content: "";
  width: 8px;
  height: 8px;
  background: currentColor;
  animation: blink 1.2s steps(2, start) infinite;
}
.step[data-status="waiting"], .step[data-status="waiting"] .step-tool,
.step[data-status="error"], .step[data-status="error"] .step-tool,
.step[data-status="waiting"] .step-icon, .step[data-status="error"] .step-icon { color: var(--warn); }
.step[data-status="declined"] .step-label, .step[data-status="declined"] .step-icon { color: var(--text-muted); }

/* Carte d'action */
.action {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  background: var(--accent-wash);
  animation: appear .35s ease both;
}
.action-head { display: flex; justify-content: space-between; gap: 12px; font: 400 11px/1.3 var(--font-data); letter-spacing: .14em; color: var(--accent); }
.action-to { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.action-title { font-size: 16px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.action-body { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.action-edit textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(3, 8, 13, .5);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  resize: vertical;
}
.action-edit textarea:focus { outline: none; border-color: var(--accent); }
.action-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.action[data-state="approved"], .action[data-state="sent"] { border-color: var(--line-mid); }
.action[data-state="declined"] { border-color: var(--line-step); background: transparent; }
.action[data-state="declined"] .action-head { color: var(--text-muted); }
.action.is-warn { border-color: var(--warn-line); background: var(--warn-wash); }
.action.is-warn .action-head { color: var(--warn); }
.action.is-warn[data-state="approved"], .action.is-warn[data-state="declined"] { border-color: var(--line-step); background: transparent; }
.action.is-warn[data-state="approved"] .action-head, .action.is-warn[data-state="declined"] .action-head { color: var(--text-muted); }

/* Journal vide */
.journal-empty { display: flex; flex-direction: column; gap: 12px; }
.journal-empty p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-dim); }
.missions { display: flex; flex-direction: column; border: 1px solid var(--line-step); }
.mission-btn {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  min-height: var(--hit);
  padding: 8px 14px;
  font-size: 14px;
  text-align: left;
  transition: background .2s;
}
.mission-btn + .mission-btn { border-top: 1px solid var(--line-soft); }
.mission-btn:hover { background: var(--accent-ghost-hover); }
.mission-btn .mono { font-size: 11px; color: var(--text-muted); }
.mission-btn svg { width: 16px; height: 16px; color: var(--text-muted); }

/* ---------- Boutons ---------- */
.btn {
  min-height: var(--hit);
  padding: 0 18px;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background .2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--text); font-weight: 500; }
.btn-ghost:hover { background: var(--accent-ghost-hover); }
.btn-text { min-height: var(--hit); padding: 0 8px; font: 400 11px/1 var(--font-data); letter-spacing: .14em; color: var(--text-muted); text-transform: uppercase; }
.btn-text:hover { color: var(--text); }

/* ---------- Barre de commande (ordinateur) ---------- */
.command { display: flex; align-items: center; gap: 16px; padding: 10px; transition: border-color .2s; }
.command:focus-within { border-color: var(--line-strong); }
.mic {
  flex: none;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  color: var(--text);
  transition: box-shadow .3s, background .3s;
}
/* Micro coupé : bouton éteint, icône barrée. Micro actif : bouton plein, onde qui pulse autour. */
.mic { position: relative; border-color: var(--line-strong); color: var(--text-muted); }
.mic:hover { color: var(--text); background: var(--accent-ghost-hover); }
.mic .ico-on, .app[data-mic="on"] .mic .ico-off { display: none; }
.app[data-mic="on"] .mic .ico-on { display: block; }
.app[data-mic="on"] .mic { border-color: var(--accent); background: var(--accent); color: var(--on-accent); box-shadow: var(--glow-mic); }
.app[data-mic="on"] .mic::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  animation: mic-ring 1.6s var(--ease) infinite;
  pointer-events: none;
}
@keyframes mic-ring { from { opacity: .8; transform: scale(.9); } to { opacity: 0; transform: scale(1.3); } }
.app[data-state="connecting"] .mic { border-color: var(--accent); color: var(--accent); animation: mic-wait 1s ease-in-out infinite; }
@keyframes mic-wait { 50% { box-shadow: 0 0 0 7px rgba(92, 225, 255, .14); } }
.mic-label { flex: none; width: 12ch; font: 400 11px/1 var(--font-data); letter-spacing: .14em; color: var(--text-muted); white-space: nowrap; }
.app[data-mic="on"] .mic-label, .app[data-state="connecting"] .mic-label { color: var(--accent); }

/* Étiquette de voix au-dessus du réacteur : ouvre le choix de la voix */
.tag-btn { padding: 0; cursor: pointer; transition: color .2s; }
.tag-btn::after { content: ""; position: absolute; inset: -14px -8px; }
.tag-btn:hover:not(:disabled), .tag-btn:focus-visible { color: var(--accent); }
.tag-btn:disabled { cursor: default; }
.voice-block { margin-inline: -10px; padding: 10px; transition: background .8s ease; }
.command-input { flex: 1; min-width: 0; height: var(--hit); border: 0; background: transparent; font-size: 17px; letter-spacing: .02em; }
.command-input::placeholder, .typebar input::placeholder { color: var(--placeholder); }
.command-input:focus, .typebar input:focus { outline: none; }
.command-hint { font: 400 11px/1 var(--font-data); letter-spacing: .12em; color: var(--text-muted); white-space: nowrap; }
.btn-run { height: 48px; padding: 0 22px; display: flex; align-items: center; gap: 10px; letter-spacing: .16em; }

/* ---------- Téléphone : éléments propres ---------- */
.phone-only, .phone-dock { display: none; }
.reply { flex-direction: column; gap: 10px; width: 100%; flex: none; padding: 14px 16px 16px; }
.reply-head { display: flex; justify-content: space-between; gap: 12px; font: 400 11px/1.3 var(--font-data); letter-spacing: .1em; }
.reply-head .who { color: var(--accent); white-space: nowrap; }
.reply-progress { color: var(--text-muted); text-align: right; }
.reply-progress.is-warn { color: var(--warn); }
.reply-text { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.row-buttons { display: flex; gap: 10px; }
.row-buttons .btn-primary { flex: 0 0 auto; padding: 0 22px; }
.row-buttons .btn-ghost { flex: 1; min-width: 0; padding: 0 12px; }
.suggests { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.suggest {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line-mid);
  background: var(--panel-bg);
  text-align: left;
  transition: background .2s;
}
.suggest:hover { background: var(--accent-ghost-hover); }
.suggest small { font: 400 10px/1.2 var(--font-data); letter-spacing: .1em; color: var(--text-muted); }
.suggest b { font-size: 14px; font-weight: 500; }
.typebar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; animation: appear .25s ease both; }
.typebar input { flex: 1; min-width: 0; height: var(--hit); border: 0; background: transparent; font-size: 16px; letter-spacing: .02em; }
.typebar .send { flex: none; width: var(--hit); height: var(--hit); display: grid; place-items: center; background: var(--accent); color: var(--on-accent); transition: background .2s; }
.typebar .send:hover { background: var(--accent-hover); }
.controls { display: flex; align-items: center; justify-content: center; gap: 32px; }
.round {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-round);
  border-radius: 50%;
  color: var(--text);
  transition: background .2s;
}
.round:hover, .round[aria-expanded="true"] { background: var(--accent-ghost-hover); }
.mic-lg { width: 76px; height: 76px; background: rgba(3, 8, 13, .6); }


/* ---------- Notifications ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  background: var(--sheet-bg);
  font-size: 14px;
  line-height: 1.4;
  transform: translateX(-50%);
  animation: appear .25s ease both;
}
.toast.is-warn { border-color: var(--warn-line); }
.scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); }

/* ---------- 900 à 1099 px : systèmes en volet ---------- */
@media (max-width: 1099px) {
  .main { grid-template-columns: minmax(0, 1fr) 360px; }
  .status-chip { cursor: pointer; }
  .status-chip:hover { background: var(--accent-ghost-hover); }
  .side-left {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 86vw);
    border-width: 0 1px 0 0;
    background: var(--sheet-bg);
    visibility: hidden;
    transform: translateX(-104%);
    transition: transform .35s var(--ease), visibility 0s linear .35s;
  }
  .side-left.is-open { visibility: visible; transform: none; transition: transform .35s var(--ease), visibility 0s; }
  .side-left::before, .side-left::after { display: none; }
  .side-left .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 0 22px;
  }
  .side-left .close { display: grid; }
  .side-scroll { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 1100px) {
  .status-chip { pointer-events: none; }
}

/* ---------- ≤ 899 px : téléphone ---------- */
@media (max-width: 899px) {
  :root {
    --bracket: 12px;
    --grid: 40px;
    --glow-ring: drop-shadow(0 0 12px rgba(92, 225, 255, .34));
    --glow-mic: 0 0 0 8px rgba(92, 225, 255, .10), 0 0 40px rgba(92, 225, 255, .6);
    --panel-bg: rgba(6, 22, 33, .72);
    --hud-bg:
      radial-gradient(ellipse 80% 40% at 50% 26%, rgba(92, 225, 255, .13), rgba(92, 225, 255, 0) 70%),
      repeating-linear-gradient(0deg, rgba(92, 225, 255, .035) 0 1px, transparent 1px var(--grid)),
      repeating-linear-gradient(90deg, rgba(92, 225, 255, .035) 0 1px, transparent 1px var(--grid)),
      var(--bg);
  }
  .panel { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .app {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 480px;
    margin-inline: auto;
    padding: 18px 20px 26px;
  }
  .top { gap: 12px; }
  .brand { gap: 10px; }
  .logo { width: 26px; height: 26px; }
  .brand-name { font-size: 16px; letter-spacing: .3em; }
  .brand-sub, .top-right, .chip-long, .command, .reactor-tag { display: none; }
  .chip-short { display: inline; }
  .status-chip { gap: 8px; min-height: var(--hit); padding: 6px 10px; font-size: 11px; letter-spacing: .08em; }
  .dot-live { width: 6px; height: 6px; box-shadow: 0 0 8px var(--accent); }

  .main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .center {
    flex: 1;
    justify-content: flex-start;
    gap: 14px;
    padding-top: 6px;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .reactor { width: min(232px, 62vw, 34vh); }
  .voice { gap: 8px; }
  .wave { height: 30px; }
  .wave span { height: 28px; }
  .status { font-size: 11px; }
  .status .blink { width: 6px; height: 6px; }
  .transcript { font-size: 17px; min-height: 0; }

  .reply.phone-only { display: flex; }
  .suggests.phone-only { display: grid; }
  .phone-dock { display: flex; flex-direction: column; gap: 14px; }

  /* Réacteur : traits plus épais pour rester lisibles à 232 px (§ 5.1) */
  .rx-1 circle { stroke-width: 1.6px; stroke-dasharray: 1.4 5.58; }
  .rx-2 { display: none; }
  .rx-3 circle { stroke-width: 12px; stroke-dasharray: 2 7.006; }
  .rx-4 circle { stroke-width: 16px; }
  .rx-5 circle { stroke-width: 3px; }
  .rx-5 path { stroke-width: 2px; }
  .rx-inner circle:first-child { stroke-width: 3px; }

  /* Journal en plein écran */
  .side-right {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    border: 0;
    padding-inline: max(0px, calc((100vw - 480px) / 2));
    background: var(--hud-bg);
  }
  .side-right::before, .side-right::after { display: none; }
  .side-right.is-open { display: flex; animation: sheet-in .28s var(--ease) both; }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } }
  .journal-head { padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px 20px; }
  .journal-title { flex-direction: column; align-items: flex-start; gap: 4px; }
  .side-right .close { display: grid; }
  .journal { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .step { grid-template-columns: 18px 76px minmax(0, 1fr); }
  .mission-btn { grid-template-columns: 76px minmax(0, 1fr) 16px; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 374px) {
  .brand-name { letter-spacing: .22em; }
  .controls { gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .blink, .caret, .msg, .steps, .step, .action, .typebar, .toast, .side-right.is-open, .is-busy .system-dot, .mic, .mic::after { animation: none !important; }
  .side-left, .system, .memory-row { transition: none; }
}
