/* Page de vérification — nuit profonde, aurore, une sphère, un mot qui brille. */
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --void: #07060f;
  --ink: #f2f0ff;
  --muted: #9a96b8;
  --glass: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .10);
  --violet: #7c5cff;
  --cyan: #2ee6f6;
  --pink: #ff5fb4;
  --spectrum: linear-gradient(110deg, var(--cyan), var(--violet) 45%, var(--pink) 90%);
  --on-spectrum: #07060f;
  --error: #ff7a8a;
  --ok: #3ef0b0;
  --display: "Space Grotesk", system-ui, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--void); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--void); color: var(--ink);
  font: 400 1rem/1.6 var(--text);
  overflow-x: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--cyan); text-decoration-color: color-mix(in srgb, var(--cyan) 40%, transparent); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 8px; }

/* Aurore de fond : trois nappes floues qui dérivent lentement */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: .32; mix-blend-mode: screen;
  animation: drift 24s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { background: var(--violet); top: -30vmax; left: -15vmax; }
.aurora span:nth-child(2) { background: var(--cyan); top: -25vmax; right: -25vmax; opacity: .18; animation-duration: 30s; }
.aurora span:nth-child(3) { background: var(--pink); bottom: -45vmax; left: 20%; opacity: .14; animation-duration: 36s; }
@keyframes drift { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); } }

.brand {
  width: 100%; max-width: 36rem; margin: 0 auto; padding: 1.6rem 1.5rem 0;
  display: flex; align-items: center; gap: .55rem;
  font: 700 .95rem var(--display); letter-spacing: .02em; color: var(--ink);
}
.brand .dot {
  width: .55rem; height: .55rem; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan); animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

main {
  width: 100%; max-width: 36rem; margin: auto;
  padding: 2.5rem 1.5rem 3rem; text-align: center;
}

/* Sphère : la « présence » du système */
.orb {
  width: 92px; height: 92px; margin: 0 auto 2rem; border-radius: 50%; position: relative;
  background: conic-gradient(from 0deg, var(--cyan), var(--violet), var(--pink), var(--cyan));
  animation: spin 9s linear infinite;
  box-shadow: 0 0 60px -6px color-mix(in srgb, var(--violet) 75%, transparent), 0 0 120px -20px color-mix(in srgb, var(--cyan) 60%, transparent);
}
.orb::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 40%), var(--void);
}
@keyframes spin { to { transform: rotate(360deg); } }

h1 {
  font: 700 clamp(2.1rem, 7.5vw, 3.1rem)/1.04 var(--display);
  letter-spacing: -.035em; margin: 0 0 1rem;
  background: linear-gradient(180deg, #ffffff 30%, #b9b3e6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { color: var(--muted); font-size: 1.04rem; margin: 0 auto 2.4rem; max-width: 28rem; }
.lead strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

/* Mots */
.words {
  list-style: none; margin: 0 0 1.6rem; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem;
}
.words li {
  display: flex; align-items: center; justify-content: center;
  min-height: 3.5rem; padding: .5rem;
  background: var(--glass); border: 1px solid var(--line); border-radius: 16px;
  font: 500 1.08rem var(--display); color: var(--muted); letter-spacing: .01em;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  user-select: none;
}
.words li.target {
  position: relative; border-color: transparent; color: var(--on-spectrum);
  background: var(--spectrum); background-size: 220% 100%;
  box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset, 0 10px 40px -10px color-mix(in srgb, var(--violet) 90%, transparent),
              0 0 28px -6px color-mix(in srgb, var(--cyan) 80%, transparent);
  animation: shimmer 4s ease-in-out infinite alternate;
}
.words mark {
  background: none; color: inherit; font-weight: 700;
  text-decoration: underline 2px; text-underline-offset: 5px; text-decoration-skip-ink: none;
}
@keyframes shimmer { to { background-position: 100% 0; } }

/* Champ */
.field {
  position: relative; display: flex; align-items: center; gap: .4rem;
  padding: .45rem; border-radius: 20px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: color-mix(in srgb, var(--cyan) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cyan) 12%, transparent), 0 0 40px -12px color-mix(in srgb, var(--cyan) 70%, transparent); }
.field.invalid { border-color: var(--error); box-shadow: 0 0 0 4px rgba(255, 122, 138, .12); }
.field input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 500 1.2rem var(--display); letter-spacing: .02em; padding: .85rem 1rem; text-align: left;
}
.field input::placeholder { color: var(--muted); opacity: .7; }
.field input:focus { outline: none; }
.field button {
  border: 0; border-radius: 15px; cursor: pointer;
  background: var(--spectrum); background-size: 160% 100%; color: var(--on-spectrum);
  font: 700 1rem var(--display); letter-spacing: .02em; padding: .9rem 1.4rem;
  transition: background-position .4s, transform .1s;
}
.field button:hover { background-position: 100% 0; }
.field button:active { transform: scale(.97); }

.error { color: var(--error); font-weight: 600; font-size: .95rem; margin: .9rem 0 0; }
.en { color: var(--muted); font-size: .82rem; margin: 2.6rem 0 0; opacity: .7; letter-spacing: .01em; }

/* Confirmation */
.done-orb { width: 104px; height: 104px; animation-duration: 3s;
  background: conic-gradient(from 0deg, var(--ok), var(--cyan), var(--ok)); 
  box-shadow: 0 0 70px -6px rgba(62, 240, 176, .7); }
.done-orb .check { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; animation: counter 3s linear infinite; }
.check path {
  fill: none; stroke: var(--ok); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 34; stroke-dashoffset: 34; animation: draw .5s ease-out .2s forwards;
}
@keyframes counter { to { transform: rotate(-360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Pages secondaires (accueil, libération par le destinataire) */
h2 { font: 700 1.15rem var(--display); margin: 2rem 0 .4rem; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0 0 2rem; text-align: left; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-direction: column; gap: .6rem; }
.actions button {
  border: 0; border-radius: 15px; cursor: pointer; padding: .95rem 1.2rem;
  font: 700 1rem var(--display); background: var(--spectrum); color: var(--on-spectrum);
}
.actions button.secondary { background: var(--glass); color: var(--ink); border: 1px solid var(--line); }
.ok { color: var(--ok); font-weight: 600; }
.note { color: var(--muted); font-size: .9rem; }

footer {
  width: 100%; max-width: 36rem; margin: 0 auto; padding: 0 1.5rem 1.6rem;
  color: var(--muted); font-size: .78rem; text-align: center; opacity: .8;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 520px) {
  .words { grid-template-columns: repeat(2, 1fr); }
  main { padding: 1.5rem 1.25rem 2.5rem; }
  .orb { width: 76px; height: 76px; margin-bottom: 1.6rem; }
  .field button { padding: .9rem 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora span, .orb, .brand .dot, .words li.target, .done-orb .check { animation: none; }
  .check path { animation: none; stroke-dashoffset: 0; }
}

/* ---- Mode « maintenir la sphère » ---------------------------------------- */
.hold {
  --p: 0%;
  position: relative; display: block; width: 168px; height: 168px; margin: .5rem auto 2.2rem;
  padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.hold .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    conic-gradient(from -90deg, var(--cyan), var(--violet) calc(var(--p) * .5), var(--pink) var(--p),
                   transparent var(--p)),
    conic-gradient(from -90deg, color-mix(in srgb, var(--cyan) 30%, transparent), color-mix(in srgb, var(--violet) 30%, transparent), color-mix(in srgb, var(--pink) 30%, transparent),
                   color-mix(in srgb, var(--cyan) 30%, transparent));
  box-shadow: 0 0 70px -10px color-mix(in srgb, var(--violet) 65%, transparent), 0 0 140px -30px color-mix(in srgb, var(--cyan) 50%, transparent);
  transition: box-shadow .3s;
}
.hold .ring::before {   /* halo qui respire, invitation au geste */
  content: ""; position: absolute; inset: -14px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent); animation: breathe 2.8s ease-in-out infinite;
}
.hold .core {
  position: absolute; inset: 9px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .28), transparent 42%),
              radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--violet) 45%, transparent), transparent 60%), var(--void);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background .4s;
}
.hold .check { width: 54%; height: 54%; opacity: 0; position: absolute; }
.hold .label {
  font: 500 .95rem var(--display); letter-spacing: .04em; color: var(--ink); opacity: .85;
  transition: opacity .2s;
}
.hold.holding .label { opacity: .5; }
.hold.complete .label { opacity: 0; }
.hold .check path { stroke: var(--ok); stroke-dasharray: 34; stroke-dashoffset: 34; animation: none; }
.hold.holding .core { transform: scale(.94); }
.hold.holding .ring { box-shadow: 0 0 90px -6px color-mix(in srgb, var(--violet) 90%, transparent), 0 0 160px -20px color-mix(in srgb, var(--pink) 60%, transparent); }
.hold.holding .ring::before { animation-duration: .9s; }
.hold.complete .ring {
  background: conic-gradient(var(--ok), var(--cyan), var(--ok));
  box-shadow: 0 0 80px -6px rgba(62, 240, 176, .8);
}
.hold.complete .ring::before { animation: none; opacity: 0; }
.hold.complete .core { transform: scale(1); }
.hold.complete .check { opacity: 1; }
.hold.complete .check path { animation: draw .45s ease-out forwards; }
.hold:focus-visible { outline: none; }
.hold:focus-visible .ring::before { border: 2px solid var(--cyan); }
@keyframes breathe { 50% { transform: scale(1.06); opacity: .35; } }

.status { min-height: 1.5em; margin: -.4rem 0 0; color: var(--cyan); font: 500 .95rem var(--display); letter-spacing: .02em; }
.alt { margin: 1.8rem 0 0; font-size: .9rem; }
.alt a { color: var(--muted); }
form.js noscript { display: none; }

@media (max-width: 520px) {
  .hold { width: 150px; height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  .hold .ring::before { animation: none; }
}

/* ---- Espace client --------------------------------------------------------- */
main.wide { max-width: 60rem; text-align: left; }
.left { text-align: left; margin-left: 0; }
.flash { padding: .75rem 1rem; border-radius: 14px; margin: 0 0 1.25rem; text-align: left;
  background: var(--glass); border: 1px solid var(--line); }
.flash.ok { border-color: rgba(62, 240, 176, .45); color: var(--ok); }
.flash.error { border-color: rgba(255, 122, 138, .5); color: var(--error); }
.pnav { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 2rem; }
.pnav .who { font: 700 1rem var(--display); margin-right: auto; color: var(--ink); }
.pnav a { padding: .45rem .9rem; border-radius: 12px; color: var(--muted); text-decoration: none;
  font: 500 .95rem var(--display); }
.pnav a[aria-current=page] { background: var(--glass); color: var(--ink); border: 1px solid var(--line); }
.pnav form { margin: 0; }
h1.page { font-size: clamp(1.8rem, 5vw, 2.4rem); text-align: left; }
h2.left { font: 700 1.1rem var(--display); margin: 2rem 0 .8rem; }
button.ghost, .actions button.ghost {
  background: var(--glass); color: var(--ink); border: 1px solid var(--line); border-radius: 13px;
  font: 600 .92rem var(--display); padding: .6rem 1rem; cursor: pointer;
}
button.ghost.danger { color: var(--error); }
button.small { padding: .35rem .7rem; font-size: .82rem; }
.search input, .addrow input, .addrow select {
  background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); font: 500 1rem var(--text); padding: .75rem 1rem;
}
.search input { width: 100%; margin-bottom: 1.2rem; }
.search input:focus, .addrow input:focus, .addrow select:focus { outline: none; border-color: rgba(46,230,246,.55); }
.addrow { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.addrow input { flex: 1 1 14rem; }
.addrow button, .bar button:not(.ghost) {
  border: 0; border-radius: 13px; cursor: pointer; background: var(--spectrum); color: var(--on-spectrum);
  font: 700 .95rem var(--display); padding: .75rem 1.2rem;
}
.mails, .entries { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.mail {
  display: flex; gap: .95rem; align-items: center;
  padding: .85rem 1rem; border-radius: 16px; background: var(--glass); border: 1px solid var(--line);
  cursor: pointer; transition: border-color .15s;
}
.mail:hover { border-color: color-mix(in srgb, var(--violet) 50%, transparent); }
.mail:has(input:checked) { border-color: var(--cyan); box-shadow: 0 0 24px -12px var(--cyan); }
.mail input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--cyan); }
.mail .txt { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.mail .from { font: 700 .98rem var(--display); overflow-wrap: anywhere; }
.mail .subject { color: var(--ink); overflow-wrap: anywhere; }
.mail .info, .entries .info { color: var(--muted); font-size: .82rem; }
.entries li { display: flex; align-items: center; gap: .8rem; padding: .6rem .9rem;
  border-radius: 14px; background: var(--glass); border: 1px solid var(--line); }
.entries .from { font: 600 .95rem var(--display); margin-right: auto; overflow-wrap: anywhere; }
.entries form { margin: 0; }
.bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 0;
  background: linear-gradient(transparent, var(--void) 35%); }
.empty { color: var(--muted); padding: 2rem 0; }
.pager { display: flex; gap: 1rem; }
code { font-size: .9em; background: var(--glass); padding: .1em .35em; border-radius: 6px; }

.wide-page .brand, .wide-page footer { max-width: 60rem; }
.wide-page footer { text-align: left; }

/* ---- Habillage client ------------------------------------------------------ */
.brand .logo { display: block; max-height: 44px; max-width: 220px; width: auto; height: auto; }
.brand.has-logo .dot { display: none; }
