/* Jarvis — direction artistique « cockpit de nuit »
   Calme, précis, nocturne. Inspiré des écrans d'avionique (Alexis est apprenti B2) :
   fond noir bleuté, phosphore cyan, ambre pour l'important, rouge pour l'urgent,
   graduations fines et étiquettes en chasse fixe. */

:root {
  --fond: #06080b;
  --fond-2: #090c11;
  --surface: #0d1218;
  --surface-2: #131a23;
  --ligne: #1a222c;
  --ligne-forte: #2a3644;
  --texte: #e9eef4;
  --texte-2: #a3afbd;   /* 9,0:1 sur --fond */
  --texte-3: #7d8a99;   /* 5,7:1 sur --fond */
  --accent: #7fe6ff;    /* phosphore cyan, 14:1 */
  --accent-sombre: #0f3440;
  --orange: #ffb75a;
  --rouge: #ff6b6b;
  --vert: #6ee7a8;

  --police: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --police-titre: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "Inter Display", Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px; --e5: 24px; --e6: 32px; --e7: 48px;
  --r1: 8px; --r2: 14px; --r3: 999px;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-micro: 160ms;
  --t-el: 280ms;
  --t-page: 480ms;

  --haut-sur: env(safe-area-inset-top, 0px);
  --bas-sur: env(safe-area-inset-bottom, 0px);
  --gauche-sur: env(safe-area-inset-left, 0px);
  --droite-sur: env(safe-area-inset-right, 0px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(120% 70% at 50% -10%, #0c1a22 0%, transparent 60%),
    var(--fond);
  color: var(--texte);
  font: 400 16px/1.5 var(--police);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg .plein { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.evitement { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--fond); padding: 8px 12px; border-radius: var(--r1); z-index: 10; }
.evitement:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Lignes fixes : le bandeau masqué ne décale pas la grille */
.entete { grid-row: 1; } .alertes { grid-row: 2; } .scene { grid-row: 3; } .dock { grid-row: 4; }

/* ---------- En-tête ---------- */
.entete {
  display: flex; align-items: center; gap: var(--e3);
  padding: calc(var(--haut-sur) + 10px) calc(var(--droite-sur) + var(--e4)) 10px calc(var(--gauche-sur) + var(--e4));
  border-bottom: 1px solid var(--ligne);
  background: linear-gradient(to bottom, rgba(6,8,11,.92), rgba(6,8,11,.7));
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  position: relative; z-index: 3;
}
.marque { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.marque-orbe {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 50%, #fff 0 18%, var(--accent) 40%, rgba(127,230,255,.1) 72%);
  box-shadow: 0 0 0 1px rgba(127,230,255,.35), 0 0 14px rgba(127,230,255,.45);
  transition: transform var(--t-el) var(--ease-out);
}
body[data-coeur=ecoute] .marque-orbe, body[data-coeur=reflexion] .marque-orbe, body[data-coeur=parole] .marque-orbe { animation: battement 1.1s var(--ease-in-out) infinite; }
@keyframes battement { 50% { transform: scale(1.35); } }
.marque-nom { font: 600 13px/1 var(--mono); letter-spacing: .32em; }
.marque-etat {
  font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--texte-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 7px; border: 1px solid var(--ligne-forte); border-radius: var(--r3);
  flex: none; max-width: 40vw;
}
@media (max-width: 480px) {
  .entete { gap: var(--e2); }
  .marque { gap: 8px; }
  .marque-nom { letter-spacing: .2em; font-size: 12px; }
  .vue-btn { padding: 6px 11px; }
  .outils .icone-btn { width: 36px; }
}
@media (max-width: 400px) { .marque-nom { display: none; } }
.marque-etat.demo { color: var(--orange); border-color: rgba(255,183,90,.4); }

.vues { display: flex; padding: 3px; border: 1px solid var(--ligne-forte); border-radius: var(--r3); background: var(--fond-2); }
.vue-btn {
  border: 0; background: none; padding: 6px 14px; border-radius: var(--r3);
  font: 500 13px/1 var(--police); color: var(--texte-2);
  transition: background var(--t-micro), color var(--t-micro), transform var(--t-micro) var(--ease-out);
}
.vue-btn[aria-pressed=true] { background: var(--surface-2); color: var(--texte); box-shadow: inset 0 0 0 1px var(--ligne-forte); }
.vue-btn:active { transform: scale(.96); }

.outils { display: flex; gap: 2px; }
.icone-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: var(--r3); background: none; color: var(--texte-2);
  transition: background var(--t-micro), color var(--t-micro), transform var(--t-micro) var(--ease-out);
}
.icone-btn:hover { background: var(--surface); color: var(--texte); }
a.icone-btn { text-decoration: none; }
a.icone-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icone-btn:active { transform: scale(.92); }
#btn-voix .barre { display: none; }
#btn-voix[aria-pressed=false] .ondes { display: none; }
#btn-voix[aria-pressed=false] .barre { display: inline; }
#btn-voix[aria-pressed=false] { color: var(--texte-3); }

/* ---------- Bandeau d'alertes ---------- */
.alertes { position: relative; z-index: 2; border-bottom: 1px solid var(--ligne); background: var(--fond-2); }
.alertes[data-niveau=rouge] { background: linear-gradient(90deg, rgba(255,107,107,.12), rgba(255,107,107,.03) 60%, var(--fond-2)); border-bottom-color: rgba(255,107,107,.35); }
.alertes[data-niveau=orange] { background: linear-gradient(90deg, rgba(255,183,90,.10), rgba(255,183,90,.02) 60%, var(--fond-2)); border-bottom-color: rgba(255,183,90,.28); }
.alertes-resume {
  width: 100%; display: flex; align-items: center; gap: var(--e3); text-align: left;
  border: 0; background: none; padding: 10px calc(var(--droite-sur) + var(--e4)) 10px calc(var(--gauche-sur) + var(--e4));
  min-height: 44px;
}
.alertes-pastilles { display: flex; gap: 6px; flex: none; }
.pastille { display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1 var(--mono); padding: 4px 7px; border-radius: var(--r3); }
.pastille::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pastille.rouge { color: var(--rouge); background: rgba(255,107,107,.12); }
.pastille.rouge::before { box-shadow: 0 0 0 0 rgba(255,107,107,.6); animation: alerte 2.4s ease-out infinite; }
.pastille.orange { color: var(--orange); background: rgba(255,183,90,.1); }
@keyframes alerte { 0% { box-shadow: 0 0 0 0 rgba(255,107,107,.55); } 70%,100% { box-shadow: 0 0 0 7px rgba(255,107,107,0); } }
.alertes-texte { flex: 1; min-width: 0; font-size: 14px; color: var(--texte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chevron { color: var(--texte-3); transition: transform var(--t-el) var(--ease-out); flex: none; }
.alertes-resume[aria-expanded=true] .chevron { transform: rotate(180deg); }
.alertes-liste { padding: 0 calc(var(--droite-sur) + var(--e4)) var(--e3) calc(var(--gauche-sur) + var(--e4)); animation: deplier var(--t-el) var(--ease-out); }
@keyframes deplier { from { opacity: 0; transform: translateY(-6px); } }
.alertes-liste ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.alertes-liste li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--ligne); font-size: 14px; }
.alertes-liste li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); transform: translateY(-1px); }
.alertes-liste li.rouge { --c: var(--rouge); }
.alertes-liste li.orange { --c: var(--orange); }
.alertes-liste li.vert { --c: var(--vert); color: var(--texte-2); }
.alertes-liste time { font: 500 11px/1 var(--mono); color: var(--texte-3); white-space: nowrap; }
.alertes-ronde { margin: 6px 0 0; font: 500 11px/1.4 var(--mono); color: var(--texte-3); letter-spacing: .04em; }

/* ---------- Scène : vues Fil et Système ---------- */
.scene { position: relative; min-height: 0; min-width: 0; overflow: clip; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.vue { grid-area: 1 / 1; min-height: 0; min-width: 0; }
.scene[data-vue=fil] .vue-systeme, .scene[data-vue=systeme] .vue-fil { visibility: hidden; opacity: 0; pointer-events: none; }
.vue { transition: opacity var(--t-el) var(--ease-out), visibility 0s linear var(--t-el); }
.scene[data-vue=fil] .vue-fil, .scene[data-vue=systeme] .vue-systeme { transition: opacity var(--t-page) var(--ease-out), visibility 0s; }

/* Système */
.vue-systeme { position: relative; overflow: hidden; }
.vue-systeme::before { /* grille fine façon écran d'instrument */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--ligne) 1px, transparent 1px), linear-gradient(90deg, var(--ligne) 1px, transparent 1px);
  background-size: 48px 48px; background-position: center;
  mask-image: radial-gradient(closest-side, rgba(0,0,0,.55), transparent);
  -webkit-mask-image: radial-gradient(closest-side, rgba(0,0,0,.55), transparent);
}
#canvas-systeme { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.calque-noeuds { position: absolute; inset: 0; pointer-events: none; }
.noeud {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  --dx: -50%; --dy: 16px;
}
.noeud > span { display: block; position: absolute; left: 0; top: 0; white-space: nowrap; transform: translate(var(--dx), var(--dy)); }
.noeud.haut { --dy: calc(-100% - 16px); }
.noeud.haut .noeud-info { --dy: calc(-100% - 36px); }
.noeud.gauche { --dx: calc(-100% - 16px); --dy: -50%; }
.noeud.droite { --dx: 16px; --dy: -50%; }
.noeud.gauche .noeud-info, .noeud.droite .noeud-info { --dy: 50%; }
.noeud.bas .noeud-info { --dy: 38px; }
/* Téléphone : toutes les étiquettes centrées sous leur point (sauf celle du haut) */
.etroit .noeud.gauche, .etroit .noeud.droite { --dx: -50%; --dy: 14px; }
.etroit .noeud.gauche .noeud-info, .etroit .noeud.droite .noeud-info, .etroit .noeud.bas .noeud-info { --dy: 34px; }
.etroit .noeud-info { max-width: 36vw; text-align: center; }
.noeud-nom { font: 600 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--texte-2); transition: color var(--t-el); }
.noeud-info { font: 400 12px/1.2 var(--police); color: var(--accent); opacity: 0; transition: opacity var(--t-el) var(--ease-out); max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
.noeud.actif .noeud-nom { color: var(--accent); }
.noeud.actif .noeud-info { opacity: 1; }
.noeud[data-alerte=rouge] .noeud-nom { color: var(--rouge); }
.noeud[data-alerte=orange] .noeud-nom { color: var(--orange); }
.systeme-legende {
  position: absolute; left: 0; right: 0; bottom: var(--e3); margin: 0; text-align: center;
  font: 500 11px/1.4 var(--mono); color: var(--texte-3); letter-spacing: .04em; padding: 0 var(--e4);
}

/* Fil */
.vue-fil { display: flex; flex-direction: column; min-height: 0; }
.fil {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: var(--e5) calc(var(--droite-sur) + var(--e4)) var(--e5) calc(var(--gauche-sur) + var(--e4));
  display: flex; flex-direction: column; gap: var(--e4);
  scroll-padding-bottom: var(--e5);
}
.fil > * { width: 100%; max-width: 720px; margin-inline: auto; }

.accueil { margin-block: auto; padding-block: var(--e6); }
.accueil > * { animation: entree var(--t-page) var(--ease-out) both; }
.accueil > :nth-child(2) { animation-delay: 80ms; }
.accueil > :nth-child(3) { animation-delay: 160ms; }
.accueil > :nth-child(4) { animation-delay: 240ms; }
@keyframes entree { from { opacity: 0; transform: translateY(14px); } }
.accueil-heure { margin: 0 0 var(--e3); font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.accueil-titre { margin: 0; font: 600 clamp(34px, 8vw, 56px)/1.02 var(--police-titre); letter-spacing: -.025em; }
.accueil-sous { margin: var(--e3) 0 var(--e5); color: var(--texte-2); font-size: 17px; }
.suggestions { display: flex; flex-wrap: wrap; gap: var(--e2); }
.suggestion {
  border: 1px solid var(--ligne-forte); background: var(--surface); color: var(--texte);
  padding: 10px 14px; border-radius: var(--r3); font-size: 15px; min-height: 44px;
  transition: border-color var(--t-micro), background var(--t-micro), transform var(--t-micro) var(--ease-out);
}
.suggestion:hover { border-color: rgba(127,230,255,.45); background: var(--surface-2); }
.suggestion:active { transform: scale(.97); }

.msg { animation: entree var(--t-el) var(--ease-out) both; }
.msg-moi { display: flex; justify-content: flex-end; }
.msg-moi .bulle {
  max-width: min(84%, 560px); background: var(--surface-2); border: 1px solid var(--ligne-forte);
  padding: 10px 14px; border-radius: 18px 18px 6px 18px; font-size: 16px; overflow-wrap: anywhere;
}
.msg-jarvis { display: grid; gap: var(--e2); padding-left: 14px; position: relative; }
.msg-jarvis::before { /* trait vertical façon repère d'instrument */
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; border-radius: 2px;
  background: linear-gradient(var(--accent), rgba(127,230,255,.08));
}
.msg-jarvis.erreur::before { background: linear-gradient(var(--rouge), rgba(255,107,107,.08)); }
.msg-meta { display: flex; align-items: center; gap: var(--e2); font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--texte-3); }
.msg-meta .relire {
  border: 0; background: none; color: var(--texte-3); padding: 6px; margin: -6px 0; border-radius: var(--r3);
  display: inline-grid; place-items: center; transition: color var(--t-micro);
}
.msg-meta .relire:hover { color: var(--accent); }
.msg-meta .relire svg { width: 16px; height: 16px; }
.msg-texte { margin: 0; font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-jarvis.erreur .msg-texte { color: var(--texte-2); }
.msg-texte a { color: var(--accent); }
.etapes { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 2px 0 0; }
.etape {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: var(--r3);
  font: 500 12px/1.2 var(--police); color: var(--texte-2); background: var(--fond-2); border: 1px solid var(--ligne);
  animation: entree var(--t-el) var(--ease-out) both;
}
.etape b { font: 600 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

.reflexion { display: flex; align-items: center; gap: 10px; color: var(--texte-2); font-size: 15px; padding-left: 14px; }
.reflexion i { display: block; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); animation: graduation 1s var(--ease-in-out) infinite; }
.reflexion i:nth-child(2) { animation-delay: .12s; }
.reflexion i:nth-child(3) { animation-delay: .24s; }
.reflexion span { display: flex; gap: 4px; }
.reflexion em { font-style: normal; }
@keyframes graduation { 0%, 100% { transform: scaleY(.35); opacity: .45; } 50% { transform: scaleY(1); opacity: 1; } }

.confirmation {
  margin-top: var(--e2); padding: var(--e4); border-radius: var(--r2);
  background: linear-gradient(180deg, rgba(255,183,90,.07), rgba(255,183,90,.02)); border: 1px solid rgba(255,183,90,.32);
  display: grid; gap: var(--e2);
}
.confirmation-titre { margin: 0; font: 600 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--orange); }
.confirmation-resume { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.confirmation-actions { display: flex; gap: var(--e2); margin-top: var(--e1); }
.confirmation-actions button {
  flex: 1; min-height: 48px; border-radius: var(--r1); font-weight: 600; font-size: 16px;
  transition: transform var(--t-micro) var(--ease-out), background var(--t-micro), opacity var(--t-el);
}
.confirmation-actions button:active { transform: scale(.97); }
.btn-go { border: 0; background: var(--accent); color: #032029; }
.btn-go:hover { background: #a6efff; }
.btn-non { border: 1px solid var(--ligne-forte); background: var(--surface); }
.btn-non:hover { background: var(--surface-2); }
.confirmation-actions button:disabled { opacity: .35; cursor: default; transform: none; }
.confirmation.faite button { opacity: .2; }
.confirmation.faite button.choisi { opacity: .7; }
.confirmation-statut { margin: 0; font: 500 12px/1.3 var(--mono); color: var(--texte-3); letter-spacing: .04em; }
.confirmation-statut:empty { display: none; }
.confirmation.faite { border-color: var(--ligne-forte); background: var(--surface); }
.confirmation.faite .confirmation-titre { color: var(--texte-3); }

/* ---------- Dock : micro + clavier ---------- */
.dock {
  position: relative; z-index: 3;
  padding: var(--e3) calc(var(--droite-sur) + var(--e4)) calc(var(--bas-sur) + var(--e3)) calc(var(--gauche-sur) + var(--e4));
  border-top: 1px solid var(--ligne);
  background: linear-gradient(to top, rgba(6,8,11,.98), rgba(6,8,11,.86));
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: grid; gap: var(--e3); justify-items: center;
}
.dock > * { width: 100%; max-width: 720px; }
.dictee { margin: 0; text-align: center; font-size: 17px; color: var(--texte); min-height: 1.5em; }
.dictee.vide { color: var(--texte-3); }

.saisie { display: none; align-items: flex-end; gap: var(--e2); background: var(--surface); border: 1px solid var(--ligne-forte); border-radius: 22px; padding: 5px 5px 5px 16px; transition: border-color var(--t-micro); }
body.clavier .saisie { display: flex; animation: entree var(--t-el) var(--ease-out); }
.saisie:focus-within { border-color: rgba(127,230,255,.5); }
.saisie textarea {
  flex: 1; border: 0; background: none; resize: none; outline: none; padding: 8px 0; max-height: 140px;
  font-size: 16px; /* 16 px : évite le zoom auto de Safari iOS */ line-height: 1.4;
}
.saisie textarea::placeholder { color: var(--texte-3); }
.envoyer {
  width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #032029; transition: opacity var(--t-micro), transform var(--t-micro) var(--ease-out);
}
.envoyer svg { width: 18px; height: 18px; stroke-width: 2; }
.envoyer:disabled { opacity: .25; cursor: default; }
.envoyer:not(:disabled):active { transform: scale(.92); }

.commandes { display: flex; align-items: center; justify-content: center; gap: clamp(24px, 10vw, 48px); }
.rond-btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--ligne-forte); background: var(--surface); color: var(--texte-2);
  transition: transform var(--t-micro) var(--ease-out), color var(--t-micro), background var(--t-micro), opacity var(--t-el);
}
.rond-btn:active:not(:disabled) { transform: scale(.92); }
.rond-btn[aria-pressed=true] { color: var(--accent); border-color: rgba(127,230,255,.45); }
.rond-btn:disabled { opacity: .3; cursor: default; }
#btn-couper:not(:disabled) { color: var(--texte); border-color: var(--texte-3); }

.micro {
  position: relative; width: 76px; height: 76px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #1a3a46, #0b1e26 70%);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(127,230,255,.45), 0 10px 30px -10px rgba(127,230,255,.35);
  transition: transform var(--t-micro) var(--ease-out), box-shadow var(--t-el);
}
.micro svg { width: 30px; height: 30px; stroke-width: 1.8; position: relative; }
.micro:active { transform: scale(.94); }
.micro-label { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--texte-3); white-space: nowrap; }
/* Anneau gradué autour du micro */
.micro-anneau {
  position: absolute; inset: -9px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(127,230,255,.5) 0 1.2deg, transparent 1.2deg 9deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  opacity: .45; transition: opacity var(--t-el);
}
.micro[aria-pressed=true] { background: radial-gradient(circle at 50% 35%, #8af0ff, #3fc6e6 75%); color: #032029; box-shadow: 0 0 0 6px rgba(127,230,255,.12), 0 0 40px rgba(127,230,255,.45); }
.micro[aria-pressed=true] .micro-anneau { opacity: 1; animation: tourne 6s linear infinite; }
.micro[aria-pressed=true] .micro-label { color: var(--accent); }
body[data-coeur=reflexion] .micro-anneau { opacity: .9; animation: tourne 2.4s linear infinite; }
@keyframes tourne { to { transform: rotate(1turn); } }
.micro:disabled { opacity: .5; }
.dock { padding-bottom: calc(var(--bas-sur) + var(--e5)); }

/* ---------- Grand écran : Système et Fil côte à côte ---------- */
.pc-seul { display: none; }
@media (min-width: 1024px) {
  .pc-seul { display: grid; }
  .vues { display: none; }
  .scene { grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr); }
  .vue { grid-area: auto; }
  .scene[data-vue] .vue { visibility: visible; opacity: 1; pointer-events: auto; }
  .vue-systeme { border-right: 1px solid var(--ligne); }
  body { grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr); grid-template-rows: auto auto 1fr auto; }
  .entete, .alertes, .scene { grid-column: 1 / -1; }
  .scene { grid-row: 3 / 5; }
  .dock { grid-column: 2; grid-row: 4; border-top: 1px solid var(--ligne); }
  .saisie { display: flex; }
  #btn-clavier { visibility: hidden; }
  .fil { padding-bottom: calc(var(--dock-h, 180px) + var(--e5)); }
  .fil > * { max-width: 640px; }
}

/* ---------- Mode « à côté de moi » (petite fenêtre sur PC) ---------- */
body.compact { grid-template-columns: minmax(0, 1fr) !important; }
body.compact .vues, body.compact .pc-seul, body.compact #btn-nouvelle, body.compact .systeme-legende { display: none !important; }
body.compact .scene { grid-template-columns: minmax(0, 1fr) !important; grid-row: auto !important; }
body.compact .dock { grid-column: 1 !important; grid-row: auto !important; padding-top: var(--e2); gap: var(--e2); }
body.compact .vue-systeme { display: none; }
body.compact .vue-fil { visibility: visible !important; opacity: 1 !important; pointer-events: auto !important; }
body.compact .entete { padding-block: 8px; }
body.compact .fil { padding-top: var(--e4); }
body.compact .accueil { padding-block: var(--e4); }
body.compact .accueil-titre { font-size: 28px; }
body.compact .accueil-sous { font-size: 15px; margin-bottom: var(--e4); }
body.compact .micro { width: 60px; height: 60px; }
body.compact .micro svg { width: 24px; height: 24px; }
body.compact .micro-label { display: none; }
body.compact .rond-btn { width: 40px; height: 40px; }
body.compact .commandes { gap: 28px; }
body.compact .dock { padding-bottom: calc(var(--bas-sur) + var(--e3)); }
body.compact .saisie { display: flex; }
body.compact #btn-clavier { visibility: hidden; }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  /* Plus aucun déplacement : tout est affiché dans son état final. */
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* ---------- Écran de connexion (cockpit de nuit) ---------- */
.connexion { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: radial-gradient(60% 50% at 50% 35%, rgba(127, 230, 255, .08), transparent 70%), var(--fond); }
.connexion[hidden] { display: none; }
.connexion-carte { width: min(100%, 400px); display: grid; gap: 12px; padding: 28px 24px; border: 1px solid var(--ligne-forte); border-radius: var(--r3, 16px); background: var(--fond-2); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.connexion-etiquette { margin: 0; font-family: var(--mono, ui-monospace, monospace); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.connexion-carte h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.connexion-sous { margin: 0 0 6px; color: var(--texte-2); font-size: 14px; }
.connexion-carte input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--ligne-forte); background: var(--fond); color: var(--texte); font: inherit; font-size: 16px; }
.connexion-carte input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(127, 230, 255, .18); }
.connexion-btn { min-height: 48px; width: 100%; font-size: 16px; }
.connexion-erreur { margin: 0; color: var(--rouge); font-size: 14px; }
.connexion-erreur[hidden] { display: none; }
#btn-notifs[aria-pressed=true] { color: var(--accent); }
