/* =====================================================================
   Univers visuel de Suivi CPE : fond sombre, lueurs, particules légères,
   un encart « verre » centré.
   ===================================================================== */

:root {
  --fond: #05070f;
  --texte: #e8ecf8;
  --texte-doux: #9aa3bf;
  --cyan: #38e1ff;
  --violet: #8b5cff;
  --rose: #ff4fd8;
  --erreur: #ff8f9c;
  --carte: rgba(18, 24, 44, 0.55);
  --bordure: rgba(160, 180, 255, 0.14);
  --champ: rgba(5, 8, 20, 0.6);
  --rayon: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Fond animé ---------- */
.fond { position: fixed; inset: 0; overflow: hidden; z-index: 0; }

.fond::after { /* fine grille, très discrète */
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(140, 160, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 160, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}

.lueur {
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  will-change: transform;
}
.lueur-1 { background: var(--violet); top: -25vmax; left: -15vmax; animation: derive-1 26s ease-in-out infinite alternate; }
.lueur-2 { background: var(--cyan);   bottom: -30vmax; right: -20vmax; opacity: 0.22; animation: derive-2 32s ease-in-out infinite alternate; }
.lueur-3 { background: var(--rose);   top: 40%; left: 55%; width: 30vmax; height: 30vmax; opacity: 0.12; animation: derive-3 38s ease-in-out infinite alternate; }

@keyframes derive-1 { to { transform: translate(12vmax, 8vmax) scale(1.1); } }
@keyframes derive-2 { to { transform: translate(-10vmax, -6vmax) scale(0.95); } }
@keyframes derive-3 { to { transform: translate(-18vmax, -10vmax) scale(1.2); } }

#particules { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Mise en page ---------- */
.scene {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  padding: 32px 16px;
}

.carte {
  width: 100%; max-width: 420px;
  padding: 34px 32px 30px;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 30px 80px -20px rgba(0, 0, 0, 0.7),
    0 0 60px -10px rgba(139, 92, 255, 0.25);
  animation: apparition 0.6s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes apparition { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ---------- Textes ---------- */
.etiquette {
  display: block;
  margin: 0 0 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--texte-doux);
}
.carte-uai .etiquette { text-align: center; margin-bottom: 18px; }

.nom-etab { margin: 0; font-size: 22px; font-weight: 650; line-height: 1.25; text-align: center; }
.sous-titre { margin: 6px 0 0; text-align: center; color: var(--texte-doux); font-size: 13px; }
.uai { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.08em; }
.texte { color: var(--texte-doux); line-height: 1.6; text-align: center; margin: 18px 0 22px; }

/* ---------- Champs ---------- */
.champ {
  width: 100%;
  margin-bottom: 18px;
  padding: 14px 16px;
  font: inherit; font-size: 16px;
  color: var(--texte);
  background: var(--champ);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.champ:focus {
  border-color: rgba(56, 225, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(56, 225, 255, 0.12), 0 0 24px rgba(56, 225, 255, 0.18);
}
.champ.en-erreur, .champ[aria-invalid="true"] { border-color: rgba(255, 143, 156, 0.7); }

.champ-uai {
  margin-bottom: 6px;
  padding: 18px 16px;
  text-align: center; text-transform: uppercase;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 28px; letter-spacing: 0.32em; text-indent: 0.32em;
}
.champ-uai::placeholder { color: rgba(154, 163, 191, 0.28); }

.message-erreur {
  min-height: 1.4em;
  margin: 0 0 14px;
  color: var(--erreur);
  font-size: 14px; line-height: 1.4;
}
.carte-uai .message-erreur { text-align: center; }
.message-erreur:empty { margin-bottom: 8px; }
.bandeau {
  margin-top: 24px; padding: 14px 16px;
  background: rgba(255, 143, 156, 0.08);
  border: 1px solid rgba(255, 143, 156, 0.3);
  border-radius: 12px; text-align: center;
}

/* ---------- Boutons ---------- */
.bouton {
  width: 100%;
  padding: 15px 18px;
  font: inherit; font-size: 15px; font-weight: 650; letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(110deg, var(--violet), #5b7bff 50%, var(--cyan));
  background-size: 200% 100%;
  border: 0; border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(91, 123, 255, 0.6);
  transition: background-position .5s, transform .15s, box-shadow .2s;
}
.bouton:hover { background-position: 100% 0; box-shadow: 0 12px 36px -8px rgba(56, 225, 255, 0.6); }
.bouton:active { transform: translateY(1px); }
.bouton:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.bouton-secondaire { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--bordure); box-shadow: none; }

/* ---------- Page établissement ---------- */
.entete-etab { display: flex; flex-direction: column; align-items: center; margin-bottom: 28px; }
.logo { max-width: 120px; max-height: 80px; object-fit: contain; margin-bottom: 16px; border-radius: 10px; background: #fff; padding: 6px; }
.monogramme {
  width: 68px; height: 68px; margin-bottom: 16px;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 700; letter-spacing: 0.04em;
  border-radius: 20px;
  background: linear-gradient(140deg, rgba(139, 92, 255, 0.35), rgba(56, 225, 255, 0.25));
  border: 1px solid rgba(160, 180, 255, 0.3);
  box-shadow: 0 0 30px rgba(139, 92, 255, 0.35);
}

.liens { margin: 18px 0 0; text-align: center; font-size: 14px; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
.lien-discret { color: var(--texte-doux); font-size: 14px; }

@media (max-width: 480px) {
  .carte { padding: 28px 20px 24px; }
  .champ-uai { font-size: 22px; letter-spacing: 0.22em; text-indent: 0.22em; }
}

/* Respect du réglage « réduire les animations » du système */
@media (prefers-reduced-motion: reduce) {
  .lueur, .carte { animation: none; }
  .bouton { transition: none; }
}
