/* Layout : le formulaire est une nuit de 'houppa (ciel étoilé, deux alliances d'or qui se rapprochent
   à chaque étape) ; l'espace admin reprend les mêmes caractères sur un papier clair, pour travailler. */
:root {
  --bg: #0b0c24;
  --bg-2: #1a1748;
  --surface: rgb(255 255 255 / .06);
  --surface-2: rgb(255 255 255 / .1);
  --ink: #f6f1e7;
  --muted: #b4b2d6;
  --line: rgb(255 255 255 / .18);
  --accent: #e6c37c;        /* or des alliances */
  --accent-2: #f3dcae;
  --accent-soft: rgb(230 195 124 / .14);
  --on-accent: #17143c;
  --gold: #e6c37c;
  --danger: #ffa49a;
  --ok: #8fe0b4;
  --display: "Cormorant Garamond", "Frank Ruhl Libre", Georgia, "Times New Roman", serif;
  --hebrew: "Frank Ruhl Libre", "Times New Roman", serif;
  --body: "Assistant", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --radius: 14px;
  color-scheme: dark;
}
body.admin {
  --bg: #f4f4fa;
  --bg-2: #f4f4fa;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --ink: #17143c;
  --muted: #5d5b82;
  --line: #d9d8ea;
  --accent: #2f2b85;
  --accent-2: #2f2b85;
  --accent-soft: #e9e8f7;
  --on-accent: #ffffff;
  --gold: #96732c;
  --danger: #b3261e;
  --ok: #1d7a4c;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.55 var(--body);
  padding-inline: 22px;
  padding-block: 20px 72px;
  min-height: 100vh;
  min-height: 100dvh;
}
body.admin { font-size: 17px; padding-block: 28px 64px; }
[hidden] { display: none !important; }

/* ---------- Ciel ---------- */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(90% 55% at 50% -8%, #3a3189 0%, transparent 70%),
    radial-gradient(70% 40% at 85% 105%, #3b2260 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 60%);
}
.sky canvas { width: 100%; height: 100%; display: block; }

.stage { max-width: 580px; margin-inline: auto; display: flex; flex-direction: column; gap: 22px; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.brand { font: 600 12px/1 var(--body); letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.bsd { font-family: var(--hebrew); color: var(--gold); font-size: 16px; direction: rtl; }

/* ---------- Alliances ---------- */
.rings { display: block; margin-inline: auto; width: 96px; max-width: 100%; height: auto; overflow: visible; transition: width .7s cubic-bezier(.2,.7,.2,1); }
body[data-view="welcome"] .rings, body[data-view="thanks"] .rings { width: 190px; }
.rings circle { fill: none; stroke-width: 3.2; transition: transform 1.1s cubic-bezier(.2,.7,.2,1); }
.ring-a { stroke: var(--accent); transform: translateX(calc(var(--gap, 44) * -1px)); }
.ring-b { stroke: var(--accent-2); transform: translateX(calc(var(--gap, 44) * 1px)); }
.rings .glow { fill: var(--accent); stroke: none; opacity: 0; transition: opacity 1.2s .5s; }
body[data-view="thanks"] .rings .glow { opacity: .16; }
.rings .spark { fill: var(--accent-2); stroke: none; opacity: 0; transform-origin: 100px 50px; transform: scale(0); transition: transform .9s .7s cubic-bezier(.2,1.4,.3,1), opacity .5s .7s; }
body[data-view="thanks"] .rings .spark { opacity: 1; transform: scale(1); }

/* ---------- Accueil ---------- */
.screen, .step { display: flex; flex-direction: column; gap: 22px; }
.welcome { text-align: center; align-items: center; gap: 20px; padding-top: 6px; }
.verse { font: 500 clamp(25px, 7.4vw, 38px)/1.35 var(--hebrew); direction: rtl; margin: 0; color: var(--accent-2); text-wrap: balance; }
.verse-fr { margin: -12px 0 0; font: italic 500 19px/1.4 var(--display); color: var(--muted); }
h1 { font: 500 clamp(42px, 11.5vw, 70px)/1 var(--display); margin: 6px 0 0; letter-spacing: -.01em; text-wrap: balance; }
h1 em { font-style: italic; color: var(--accent); }
.intro { margin: 0; color: var(--ink); opacity: .9; max-width: 44ch; font-size: 19px; }
.promises { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; }
.promises li { font-size: 15px; letter-spacing: .02em; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.promises li::before { content: "✦"; color: var(--gold); margin-right: 8px; font-size: 11px; vertical-align: 1px; }

/* ---------- Étapes ---------- */
form { display: flex; flex-direction: column; gap: 26px; }
.progress { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.progress-label { font: 600 12px/1 var(--body); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.bar { width: 100%; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .7s cubic-bezier(.2,.7,.2,1); }
.step-head { display: flex; flex-direction: column; gap: 6px; text-align: center; padding-block: 6px 4px; }
h2 { font: 500 clamp(34px, 9vw, 46px)/1.05 var(--display); margin: 0; text-wrap: balance; }
.step-head p { margin: 0; font: italic 500 20px/1.35 var(--display); color: var(--muted); text-wrap: balance; }

.field { display: flex; flex-direction: column; gap: 9px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > label, .field > legend { font-weight: 600; padding: 0; font-size: 17px; letter-spacing: .01em; }
.req { color: var(--gold); margin-left: 4px; }
.help { color: var(--muted); font-size: 15px; margin: -4px 0 0; }
.error-msg { color: var(--danger); font-size: 15px; font-weight: 600; margin: 0; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="password"], input[type="search"], textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; min-height: 54px;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:hover, textarea:hover, select:hover { background: var(--surface-2); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-2); }
button:focus-visible, a:focus-visible, .choice input:focus-visible + span, input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.invalid input, .invalid textarea, .invalid select { border-color: var(--danger); }
.date3 { display: grid; grid-template-columns: 1fr 1.5fr 1.2fr; gap: 8px; }
.date3 select { padding-inline: 12px; min-width: 0; }

.choices { display: flex; flex-wrap: wrap; gap: 9px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: block; padding: 12px 19px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.choice:hover span { border-color: var(--accent); }
.choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.choice input:active + span { transform: scale(.97); }

.consent { display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.consent input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.consent label { font-size: 16px; line-height: 1.45; }

/* ---------- Boutons ---------- */
button, .btn {
  font: 600 16px/1 var(--body); border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 12px 16px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  transition: background-color .15s, border-color .15s, transform .15s, box-shadow .2s;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.cta {
  font-size: 18px; letter-spacing: .02em; padding: 18px 34px; min-height: 60px; border-radius: 999px; border: 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--on-accent);
  box-shadow: 0 10px 34px rgb(230 195 124 / .28), inset 0 1px 0 rgb(255 255 255 / .5);
}
button.cta:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgb(230 195 124 / .4), inset 0 1px 0 rgb(255 255 255 / .5); }
button.cta:active { transform: translateY(0); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); }
button.danger { color: var(--danger); }
button:disabled { opacity: .55; cursor: default; transform: none; }
button.small, .btn.small { font-size: 14px; padding: 8px 11px; min-height: 36px; border-radius: 10px; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap-reverse; padding-top: 6px; }
.nav .cta { flex: 1; min-width: 200px; }

.banner { padding: 12px 14px; border-radius: var(--radius); border: 1px dashed var(--gold); color: var(--ink); font-size: 15px; }
.banner.error { border: 1px solid var(--danger); color: var(--danger); font-weight: 600; }
.footnote { color: var(--muted); font-size: 14px; margin: 0; }
.center { text-align: center; }

.thanks { text-align: center; align-items: center; gap: 18px; padding-top: 10px; }
.thanks p { margin: 0; font-size: 20px; max-width: 40ch; }
.thanks .hatslaha { font: 500 30px/1 var(--hebrew); color: var(--accent); direction: rtl; margin-top: 10px; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  .step, .thanks > * { animation: rise .55s cubic-bezier(.2,.7,.2,1) both; }
  .step > *:nth-child(n+2) { animation: rise .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 1) * 45ms); }
  .welcome > * { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
  .welcome > *:nth-child(2) { animation-delay: .12s; } .welcome > *:nth-child(3) { animation-delay: .28s; }
  .welcome > *:nth-child(4) { animation-delay: .4s; } .welcome > *:nth-child(5) { animation-delay: .52s; }
  .welcome > *:nth-child(6) { animation-delay: .64s; } .welcome > *:nth-child(7) { animation-delay: .76s; }
  .thanks > *:nth-child(2) { animation-delay: .9s; } .thanks > *:nth-child(3) { animation-delay: 1.1s; } .thanks > *:nth-child(4) { animation-delay: 1.3s; }
  .thanks > *:nth-child(1) { animation-delay: .7s; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ======================= Admin ======================= */
.wrap { max-width: 1040px; margin-inline: auto; display: flex; flex-direction: column; gap: 26px; }
.admin h1 { font: 600 40px/1.05 var(--display); margin: 0; letter-spacing: 0; }
.admin h2 { font: 600 28px/1.15 var(--display); text-align: left; }
.admin input, .admin textarea, .admin select { min-height: 48px; padding: 11px 14px; border-radius: 10px; }
.admin textarea { min-height: 110px; }
.admin button, .admin .btn { border-radius: 10px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.topbar h1 { flex: 1; min-width: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 12px 14px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.panel { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row .grow { flex: 1; min-width: 180px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.sharelink { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; word-break: break-all; user-select: all; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
th { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr:focus-visible { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }
.empty { padding: 30px 16px; color: var(--muted); text-align: center; }

.detail dl { display: grid; grid-template-columns: minmax(120px, 230px) 1fr; gap: 8px 18px; margin: 0; }
.detail dt { color: var(--muted); font-size: 15px; }
.detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 560px) { .detail dl { grid-template-columns: 1fr; gap: 2px; } .detail dd { margin-bottom: 10px; } }

.crit-list { display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 0; padding: 0; }
.crit { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.crit.is-section { background: transparent; border: 0; border-bottom: 2px solid var(--gold); border-radius: 0; margin-top: 18px; }
.crit.is-hidden .crit-name { opacity: .5; text-decoration: line-through; }
.crit-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; }
.crit.is-section .crit-head { padding-left: 2px; }
.crit-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crit.is-section .crit-name { font: 600 25px/1.2 var(--display); }
.tag { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tag.must { color: var(--accent); }
.crit-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 12px 14px 16px; border-top: 1px solid var(--line); }
.crit.is-section .crit-body { border-top: 0; padding-inline: 2px; }
.crit-body .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .crit-body { grid-template-columns: 1fr; } .crit-head .tag { display: none; } }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.savebar { position: sticky; bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgb(23 20 60 / .16); }
.savebar .status { flex: 1; min-width: 140px; color: var(--muted); font-size: 15px; }
.login { max-width: 420px; }
