/* Écran d'accès sur invitation : l'application floutée derrière, la carte du code devant */
:root {
  --bg: #07051A; --surface: #120F2E; --panel: rgba(28,24,69,.72); --line: rgba(168,85,247,.22);
  --fg: #EDE8FF; --fg2: #B8A9E0; --fgm: #7E70A8; --acc: #7C3AED; --acc2: #A855F7; --acc3: #C084FC;
  --err: #FCA5A5; --ok: #6EE7B7; --ghost: rgba(124,58,237,.35); --ghost2: rgba(255,255,255,.06);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F0EDFF; --surface: #FFFFFF; --panel: rgba(255,255,255,.82); --line: rgba(124,58,237,.22);
  --fg: #1E1B4B; --fg2: #4C3B8A; --fgm: #7C6AAE; --acc3: #7C3AED;
  --err: #B91C1C; --ok: #047857; --ghost: rgba(124,58,237,.25); --ghost2: rgba(124,58,237,.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--fg); font: 400 15px/1.55 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

/* ── Aperçu flouté ── */
.ghost {
  position: fixed; inset: -24px; display: flex; gap: 0; filter: blur(14px) saturate(1.1);
  opacity: .9; pointer-events: none; user-select: none;
}
.ghost-rail { width: 76px; background: var(--ghost2); display: flex; flex-direction: column; align-items: center; gap: 22px; padding-top: 30px; }
.ghost-rail i { width: 38px; height: 38px; border-radius: 12px; background: var(--ghost); }
.ghost-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ghost-head { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--line); }
.ghost-brand { width: 120px; height: 18px; border-radius: 6px; background: var(--ghost); }
.ghost-switch { width: 220px; height: 34px; border-radius: 40px; background: linear-gradient(90deg, var(--acc) 50%, var(--ghost2) 50%); }
.ghost-user { width: 110px; height: 30px; border-radius: 30px; background: var(--ghost2); }
.ghost-chat { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 40px 8%; }
.ghost-msg { max-width: 60%; padding: 14px 18px; border-radius: 18px; font-size: 14px; color: var(--fg2); }
.ghost-msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; }
.ghost-msg.ai { background: var(--ghost2); border: 1px solid var(--line); }
.ghost-table { display: block; height: 70px; margin-top: 10px; border-radius: 10px; background: repeating-linear-gradient(180deg, var(--ghost) 0 2px, transparent 2px 22px); }
.ghost-table.tall { height: 150px; }
.ghost-input { height: 54px; margin: 0 8% 30px; border-radius: 30px; background: var(--ghost2); border: 1px solid var(--line); }
.ghost-dock { width: 340px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 80px 20px; align-content: start; background: var(--ghost2); }
.ghost-dock i { height: 120px; border-radius: 14px; background: var(--ghost); opacity: .6; }
@media (max-width: 900px) { .ghost-dock { display: none; } }
@media (max-width: 600px) { .ghost-rail { display: none; } .ghost-msg { max-width: 85%; } }

/* ── Carte ── */
.gate {
  position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.card {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 30px 26px 22px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.55);
}
.card[hidden] { display: none; }
.logo { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--acc), var(--acc2)); box-shadow: 0 10px 30px -8px var(--acc); margin-bottom: 4px; }
.tag { margin: 0; font: 600 11px/1 'Inter', sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--acc3); }
h1 { margin: 0; font: 700 26px/1.15 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -.01em; }
.lead { margin: 0 0 6px; color: var(--fg2); font-size: 14.5px; }
form { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 12.5px; font-weight: 600; color: var(--fg2); }
input {
  width: 100%; padding: 13px 14px; border-radius: 12px; font: 500 16px 'Inter', sans-serif; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); outline: none;
}
#codeInput { font-family: 'Share Tech Mono', ui-monospace, monospace; font-size: 20px; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
input:focus { border-color: var(--acc2); box-shadow: 0 0 0 3px rgba(168,85,247,.25); }
.err { margin: 0; min-height: 18px; font-size: 13px; color: var(--err); }
.ok { margin: 0; font-size: 13px; color: var(--ok); }
.ok:empty { display: none; }
.btn {
  margin-top: 2px; padding: 13px; border: none; border-radius: 12px; cursor: pointer; color: #fff;
  font: 700 15px 'Inter', sans-serif; background: linear-gradient(135deg, var(--acc), var(--acc2));
}
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: none; color: var(--fgm); font: 500 13px 'Inter', sans-serif; cursor: pointer; padding: 6px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--fg); }
:focus-visible { outline: 2px solid var(--acc3); outline-offset: 2px; }
.legal { margin: 0; font-size: 12px; color: var(--fgm); text-align: center; }
.legal a { color: var(--fgm); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
