/* Écran de connexion (préfixe lg-). Charte : bg #0e1013, card #15181c, border #1e293b, accent #7fa3e8. */
html.lg-locked .app, html.lg-locked #modal { display: none !important; }
html.lg-locked, html.lg-locked body { overflow: hidden; background: #0e1013; }

.lg-root {
  --lg-bg: #0e1013; --lg-card: #15181c; --lg-border: #1e293b; --lg-accent: #7fa3e8;
  --lg-fg: #f1f5f9; --lg-muted: #94a3b8; --lg-danger: #f0707a; --lg-ok: #4ade80; --lg-r: 18px;
  position: fixed; inset: 0; z-index: 9000;
  display: flex; justify-content: center; align-items: safe center;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(91,134,220,.20), transparent 70%),
    radial-gradient(50% 40% at 100% 100%, rgba(91,134,220,.10), transparent 70%),
    var(--lg-bg);
  color: var(--lg-fg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.lg-root[hidden] { display: none; }
.lg-root *, .lg-root *::before, .lg-root *::after { box-sizing: border-box; }
.lg-shell { width: 100%; max-width: 400px; margin: auto; animation: lg-in .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes lg-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.lg-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.lg-logo {
  width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px;
  background: #0e1013; border: 1px solid var(--lg-border);
  color: var(--lg-accent); font-size: 32px; line-height: 1; overflow: hidden;
  box-shadow: 0 0 0 6px rgba(91,134,220,.06), 0 10px 40px rgba(91,134,220,.28);
  animation: lg-float 5s ease-in-out infinite;
}
@keyframes lg-float { 50% { transform: translateY(-3px); } }
.lg-logo img { width: 44px; height: 44px; object-fit: contain; display: block; }
.lg-name { font-size: 22px; font-weight: 700; letter-spacing: -.025em; color: var(--lg-accent); }
.lg-name b { color: var(--lg-accent); font-weight: 700; }
.lg-tag { margin: 0; color: var(--lg-muted); font-size: 14px; }

.lg-card {
  background: var(--lg-card); border: 1px solid var(--lg-border); border-radius: var(--lg-r);
  padding: 24px 20px; box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
@media (min-width: 420px) { .lg-card { padding: 28px; } }
.lg-title { margin: 0 0 4px; font-size: 18px; font-weight: 650; }
.lg-sub { margin: 0 0 18px; color: var(--lg-muted); font-size: 14px; line-height: 1.5; }
.lg-view { animation: lg-view .28s ease both; }
@keyframes lg-view { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.lg-btn {
  appearance: none; -webkit-appearance: none; font: inherit; width: 100%; min-height: 48px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 14px; border: 1px solid var(--lg-border); background: transparent; color: var(--lg-fg);
  font-size: 16px; font-weight: 600; cursor: pointer; touch-action: manipulation;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.lg-btn:hover { background: rgba(255,255,255,.04); border-color: #3a3a44; }
.lg-btn:active { transform: scale(.985); }
.lg-btn:disabled { opacity: .6; cursor: default; }
.lg-btn.lg-primary { background: var(--lg-accent); border-color: var(--lg-accent); color: #07121d; box-shadow: 0 8px 28px rgba(91,134,220,.32); }
.lg-btn.lg-primary:hover { background: #66adee; }
.lg-btn.lg-danger { background: var(--lg-danger); border-color: var(--lg-danger); color: #1a0508; }
.lg-btn svg { width: 22px; height: 22px; flex: none; }
.lg-link {
  appearance: none; background: none; border: 0; font: inherit; color: var(--lg-accent); cursor: pointer;
  min-height: 44px; padding: 0 8px; font-size: 14px; border-radius: 10px; touch-action: manipulation;
}
.lg-link:hover { text-decoration: underline; }
.lg-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; margin-top: 6px; }
.lg-sep { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--lg-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.lg-sep::before, .lg-sep::after { content: ""; flex: 1; height: 1px; background: var(--lg-border); }
.lg-stack { display: grid; gap: 10px; }

.lg-field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 14px; color: var(--lg-muted); }
.lg-input {
  font: inherit; font-size: 16px; /* 16px : évite le zoom auto d'iOS */ color: var(--lg-fg);
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px;
  background: #121216; border: 1px solid var(--lg-border); transition: border-color .15s, box-shadow .15s;
}
.lg-input::placeholder { color: #5f5f68; }
.lg-input:hover { border-color: #3a3a44; }
.lg-pw { position: relative; }
.lg-pw .lg-input { padding-right: 52px; }
.lg-eye {
  position: absolute; right: 4px; top: 0; height: 100%; min-width: 44px; padding: 0 10px; background: none; border: 0; border-radius: 10px;
  color: var(--lg-muted); font: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.lg-eye:hover { color: var(--lg-fg); }

.lg-otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 4px 0 6px; }
.lg-cell {
  font: inherit; font-size: 22px; font-weight: 600; text-align: center; color: var(--lg-fg);
  width: 100%; min-width: 0; height: 56px; padding: 0; border-radius: 12px;
  background: #121216; border: 1px solid var(--lg-border); caret-color: var(--lg-accent);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.lg-cell.lg-filled { border-color: #3d6f9f; }
.lg-otp.lg-shake { animation: lg-shake .35s; }
@keyframes lg-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.lg-input:focus-visible, .lg-cell:focus-visible, .lg-btn:focus-visible, .lg-link:focus-visible, .lg-eye:focus-visible {
  outline: 2px solid var(--lg-accent); outline-offset: 2px;
}
.lg-input:focus-visible, .lg-cell:focus-visible { border-color: var(--lg-accent); box-shadow: 0 0 0 4px rgba(91,134,220,.18); }

.lg-err { min-height: 20px; margin: 4px 0 10px; color: var(--lg-danger); font-size: 13px; line-height: 1.4; }
.lg-err:empty { min-height: 0; margin: 0; }
.lg-note { margin: 14px 0 0; color: var(--lg-muted); font-size: 12px; line-height: 1.5; }
.lg-note em { font-style: normal; color: #b8b8c0; }
.lg-foot { margin: 18px 4px 0; text-align: center; color: var(--lg-muted); font-size: 13px; line-height: 1.5; }
.lg-install { margin-top: 12px; }
.lg-install[hidden] { display: none; }

/* Passkey simulée */
.lg-pk { display: grid; place-items: center; gap: 14px; padding: 18px 0 6px; text-align: center; }
.lg-pk-ring {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: var(--lg-accent);
  border: 2px solid rgba(91,134,220,.35); position: relative;
}
.lg-pk-ring svg { width: 40px; height: 40px; }
.lg-pk-ring::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--lg-accent); animation: lg-spin 1s linear infinite; }
.lg-pk.lg-done .lg-pk-ring { color: var(--lg-ok); border-color: var(--lg-ok); }
.lg-pk.lg-done .lg-pk-ring::after { display: none; }
@keyframes lg-spin { to { transform: rotate(360deg); } }
.lg-pk p { margin: 0; color: var(--lg-muted); font-size: 14px; }

/* Modale maison de déconnexion */
.lg-modal { position: fixed; inset: 0; z-index: 9100; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.65); animation: lg-fade .2s ease both; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
@keyframes lg-fade { from { opacity: 0; } to { opacity: 1; } }
.lg-modal .lg-box { width: 100%; max-width: 360px; background: #15181c; border: 1px solid #1e293b; border-radius: 18px; padding: 22px; color: #f1f5f9; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.lg-modal h2 { margin: 0 0 6px; font-size: 18px; }
.lg-modal p { margin: 0 0 18px; color: #94a3b8; font-size: 14px; line-height: 1.5; }
.lg-modal .lg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lg-modal *, .lg-modal *::before { box-sizing: border-box; }
.lg-modal .lg-btn { --lg-accent: #7fa3e8; --lg-border: #1e293b; --lg-fg: #f1f5f9; --lg-danger: #f0707a; }
.lg-modal .lg-btn:focus-visible { outline: 2px solid #7fa3e8; outline-offset: 2px; }

@media (max-width: 380px) { .lg-otp { gap: 6px; } .lg-cell { height: 52px; font-size: 20px; } }
@media (max-height: 560px) { .lg-brand { margin-bottom: 12px; } .lg-logo { width: 48px; height: 48px; font-size: 24px; border-radius: 15px; } }
@media (prefers-reduced-motion: reduce) {
  .lg-root *, .lg-modal, .lg-modal * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Titre lu par les lecteurs d'écran seulement */
.lg-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* « Mot de passe oublié ? » collé sous le champ, aligné à droite */
.lg-forgot { display: flex; justify-content: flex-end; margin: -6px 0 6px; }
.lg-forgot .lg-link { min-height: 32px; padding: 0 2px; font-size: 13px; }
/* Logo : halo néon qui respire et reflet qui passe */
.lg-logo { position: relative; animation: lg-float 5s ease-in-out infinite, lg-glow 3.2s ease-in-out infinite; }
@keyframes lg-glow {
  0%, 100% { box-shadow: 0 0 0 6px rgba(91,134,220,.06), 0 10px 40px rgba(91,134,220,.22); }
  50% { box-shadow: 0 0 0 7px rgba(91,134,220,.12), 0 10px 54px rgba(120,160,240,.5); }
}
.lg-logo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%);
  transform: translateX(-120%); animation: lg-shine 4.5s ease-in-out 1s infinite;
}
@keyframes lg-shine { 0%, 60% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .lg-logo, .lg-logo::after { animation: none; } }

/* Anti-robot Cloudflare Turnstile en « interaction-only » : invisible (aucune place prise) tant que Cloudflare n'a pas de doute.
   Quand la case apparaît : case d'origine de Cloudflare, sans habillage, centrée. */
.lg-ts { display: flex; justify-content: center; }
.lg-ts.lg-ts-on { margin: 2px 0 12px; }
