:root {
  --pine: #0e2a23;
  --cream: #fffaf2;
  --cream-2: #f6eee1;
  --ink: #2b2420;
  --muted: #7a6f66;
  --line: #e7dccb;
  --red: #b3261e;
  --red-2: #8f1d17;
  --gold: #d9a441;
  --green: #2f7a55;
  --ok-bg: #e6f2ea;
  --ok-ink: #1f5a3d;
  --warn-bg: #fbeee0;
  --warn-ink: #8a4b12;
  --radius: 18px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .6);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 50% -15%, #23584a 0%, transparent 60%),
    radial-gradient(800px 500px at 110% 110%, #4a1a15 0%, transparent 55%),
    var(--pine);
  background-attachment: fixed;
}

/* ------------------------------------------------------------------ neige */
.snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.flake {
  position: absolute;
  top: -12px;
  border-radius: 50%;
  background: #fff;
  animation: fall linear infinite;
}
@keyframes fall { to { transform: translate3d(var(--drift, 20px), 106vh, 0); } }
@media (prefers-reduced-motion: reduce) { .snow { display: none; } }

/* ------------------------------------------------------------------ mise en page */
.wrap { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 48px 16px 64px; }
.stack > * + * { margin-top: 16px; }

.hero { text-align: center; color: var(--cream); margin-bottom: 28px; }
.hero-badge {
  width: 68px; height: 68px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 34px;
  border-radius: 50%;
  background: rgba(255, 250, 242, .08);
  border: 1px solid rgba(255, 250, 242, .2);
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(34px, 8vw, 54px);
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.hero.compact h1 { font-size: clamp(28px, 6vw, 40px); }
.lead { margin: 0 auto; max-width: 470px; color: rgba(255, 250, 242, .78); font-size: 17px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; margin: 18px 0 0; }
.chips:empty { display: none; }
.chip {
  padding: 6px 14px; border-radius: 999px; font-size: 14px; color: var(--cream);
  background: rgba(255, 250, 242, .1); border: 1px solid rgba(255, 250, 242, .2);
}

.card { background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.panel-title { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.2; margin: 0 0 10px; }
.section-title { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 26px 0 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.empty { text-align: center; padding: 12px 0; }
.empty-icon { font-size: 40px; margin-bottom: 6px; }

.footer { text-align: center; margin-top: 24px; font-size: 14px; color: rgba(255, 250, 242, .55); }
.footer a, .link-light { color: inherit; font: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

@media (max-width: 520px) {
  .wrap { padding-top: 32px; }
  .card { padding: 20px; }
}

/* ------------------------------------------------------------------ progression */
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.bar { height: 10px; border-radius: 999px; background: var(--cream-2); border: 1px solid var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .6s ease; }

/* ------------------------------------------------------------------ prénoms */
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.name {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.name:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--red); box-shadow: 0 10px 20px -12px rgba(179, 38, 30, .7); }
.name:disabled { cursor: default; background: var(--cream-2); color: var(--muted); }
.label { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.label > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label small { font-size: 12px; color: var(--muted); }
.initial {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red); color: var(--cream);
  font-family: var(--serif); font-size: 16px;
}
.name:disabled .initial, .initial.done { background: var(--green); }

/* ------------------------------------------------------------------ boutons et champs */
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn {
  font: inherit; font-size: 16px; line-height: 1.2;
  padding: 12px 20px; border-radius: 12px;
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s ease, transform .1s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--red); color: var(--cream); }
.btn.primary:hover:not(:disabled) { background: var(--red-2); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: var(--cream-2); }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(179, 38, 30, .45); }
.btn.danger:hover:not(:disabled) { background: #fbe9e7; }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.icon-btn {
  flex: none; width: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 20px; cursor: pointer;
}
.icon-btn:hover { color: var(--red); border-color: var(--red); }

.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.actions.start { justify-content: flex-start; }
.actions.center { justify-content: center; }

.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field em { font-style: normal; font-size: 12px; opacity: .8; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
input, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus { border-color: var(--gold); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-2 .span-2 { grid-column: 1 / -1; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

.form-msg { margin: 10px 0 0; font-size: 14px; }
.form-msg:empty { display: none; }
.form-msg.error, .error { color: var(--red); }
.form-msg.ok { color: var(--ok-ink); }

.status { padding: 10px 14px; border-radius: 12px; font-size: 14px; margin: 12px 0; }
.status.ok { background: var(--ok-bg); color: var(--ok-ink); }
.status.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ------------------------------------------------------------------ fenêtre de tirage */
.modal {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 16px;
  background: rgba(6, 18, 14, .74);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-box {
  position: relative; overflow: hidden;
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--cream); border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow); animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal-box h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1.2; margin: 0 0 8px; overflow-wrap: anywhere; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--muted); margin: 0; text-align: center; }
.slot {
  margin: 16px 0 12px; height: 100px; border-radius: 16px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--pine); color: var(--cream);
  font-family: var(--serif); font-size: 32px;
}
.slot span { animation: tick .1s ease-out; padding: 0 12px; text-align: center; overflow-wrap: anywhere; }
@keyframes tick { from { transform: translateY(-40%); opacity: .2; } }
.reveal {
  text-align: center; font-family: var(--serif); color: var(--red);
  font-size: clamp(38px, 11vw, 56px); line-height: 1.1;
  margin: 10px 0 14px; overflow-wrap: anywhere;
  animation: reveal .7s cubic-bezier(.2, .8, .2, 1.2);
}
@keyframes reveal { from { transform: scale(.55); opacity: 0; filter: blur(6px); } }
.sparks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.spark { position: absolute; width: 8px; height: 8px; border-radius: 2px; pointer-events: none; animation: spark 1.1s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .reveal, .modal-box, .slot span { animation: none; }
  .spark { display: none; }
}

/* ------------------------------------------------------------------ organisateur */
.share { display: flex; gap: 8px; }
.share input { flex: 1; min-width: 0; }
.share .btn { flex: none; }
.rows { list-style: none; margin: 16px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.rows li + li { border-top: 1px solid var(--line); }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: 13px; }
.badge { flex: none; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--cream-2); color: var(--muted); }
.sub-head { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 10px; }
.sub { font-family: var(--serif); font-weight: 500; font-size: 19px; margin: 0; }
.name-row { display: flex; gap: 8px; margin-bottom: 8px; }
.name-row input { flex: 1; min-width: 0; }
