.st-aide {
  --aide-fond: #17181c;
  --aide-texte: #f4f4f6;
  --aide-doux: #aeb0ba;
  --aide-trait: #3a3b44;
  --aide-plat: #22232a;
  position: fixed;
  z-index: 780;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  color: var(--aide-texte);
  font: 400 14px/1.5 system-ui, sans-serif;
}

body:not(.stu-on) .st-aide,
.st-aide [hidden] { display: none !important; }

.st-aide button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.st-aide button:focus-visible {
  outline: 2px solid #ffb6a3;
  outline-offset: 2px;
}

.st-aide-bouton {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid var(--aide-trait);
  border-radius: 999px;
  background: var(--aide-fond);
  box-shadow: 0 5px 20px #0004;
}

.st-aide-bouton span { color: #ffae9c; font-size: 19px; line-height: 1; }
.st-aide-bouton b { font-size: 12px; font-weight: 650; }

.st-aide-panneau {
  position: absolute;
  right: 0;
  bottom: 53px;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 36px));
  max-height: min(620px, calc(100dvh - 108px));
  border: 1px solid var(--aide-trait);
  border-radius: 18px;
  background: var(--aide-fond);
  box-shadow: 0 18px 68px #0009;
  overflow: hidden;
}

.st-aide-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--aide-trait);
}

.st-aide-tete div { min-width: 0; }
.st-aide-tete span { color: var(--aide-doux); font-size: 11px; }
.st-aide-tete h2 {
  margin: 1px 0 0;
  overflow: hidden;
  color: inherit;
  font: 650 18px/1.25 system-ui, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-aide-icone,
.st-aide-envoyer {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--aide-trait);
  border-radius: 10px;
  background: var(--aide-plat);
}

.st-aide .st-aide-icone { font-size: 21px; }
.st-aide .st-aide-envoyer {
  border-color: transparent;
  background: #ffc4b5;
  color: #281b1a;
  font-size: 19px;
  font-weight: 700;
}
.st-aide-envoyer:disabled { cursor: default; opacity: .5; }
.st-aide-micro span {
  position: relative;
  width: 13px;
  height: 15px;
  margin-top: -5px;
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 9px 9px;
}
.st-aide-micro span::before,
.st-aide-micro span::after { position: absolute; left: 50%; content: ""; transform: translateX(-50%); }
.st-aide-micro span::before { top: -3px; width: 5px; height: 13px; border: 1.5px solid currentColor; border-radius: 6px; }
.st-aide-micro span::after { bottom: -5px; width: 1.5px; height: 4px; background: currentColor; }
.st-aide-micro[aria-pressed="true"] { color: #ffc4b5; border-color: #ffc4b5; }

.st-aide-fil {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
  padding: 14px 16px;
  overflow: auto;
  overscroll-behavior: contain;
}
.st-aide-intro, .st-aide-attente { margin: 0; color: var(--aide-doux); }

.st-aide .st-aide-action {
  align-self: flex-start;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--aide-trait);
  border-radius: 8px;
  background: var(--aide-plat);
  font-size: 13px;
  text-align: left;
}
.st-aide button:hover:not(:disabled) { border-color: #a19a99; }
.st-aide-message { display: grid; justify-items: start; gap: 7px; }
.st-aide-message p { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.st-aide-moi { justify-items: end; }
.st-aide-moi p { max-width: 94%; padding: 8px 11px; border-radius: 11px 11px 3px 11px; background: var(--aide-plat); }
.st-aide-date {
  display: grid;
  justify-items: start;
  gap: 5px;
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--aide-trait);
  border-radius: 11px;
}
.st-aide-date b { overflow-wrap: anywhere; }
.st-aide-date small, .st-aide-date p { color: var(--aide-doux); font-size: 12px; }

.st-aide-actions { padding: 2px 16px 8px; }
.st-aide-form { display: flex; align-items: end; gap: 7px; margin: 0; padding: 2px 16px 9px; }
.st-aide-form textarea {
  flex: 1;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--aide-trait);
  border-radius: 10px;
  background: var(--aide-plat);
  color: inherit;
  font: inherit;
  font-size: 16px;
  resize: none;
}
.st-aide-form textarea::placeholder { color: var(--aide-doux); }
.st-aide-form textarea:focus { outline: 1px solid #ffc4b5; }
.st-aide-statut { margin: 0; padding: 0 16px 10px; color: var(--aide-doux); font-size: 12px; }
.st-aide-statut:empty { display: none; }

@media (max-width: 760px) {
  body.stu-on .st-aide { right: max(12px, env(safe-area-inset-right)); bottom: calc(68px + env(safe-area-inset-bottom)); }
  .st-aide-panneau { width: min(400px, calc(100vw - 24px)); max-height: min(550px, calc(100dvh - 148px)); }
}

@media (max-height: 465px) {
  .st-aide-fil { min-height: 45px; }
  .st-aide-tete { padding-block: 6px; }
}
