:root {
  --cream: #F5EDE0;
  --ink: #2A190E;
  --brown: #3B2416;
  --ochre: #A8641E;
  --ochre-dark: #7A440F;
  --indigo: #1F2A4A;
  --muted: #5E4A3A;
  --line: #D8C7AE;
  --ok: #2F6B3A;
  --danger: #9A2A1A;
  --names: var(--ochre);
  --tint: #F3E2C8;
  --foot: #EADCC6;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--brown);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  -webkit-text-size-adjust: 100%;
}
body.danfani { background: var(--indigo); }
.sans { font-family: Montserrat, system-ui, sans-serif; }
.wrap { max-width: 540px; margin: 0 auto; padding: 16px 12px 40px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Carte faire-part ---------- */
.card {
  position: relative;
  background: var(--cream);
  overflow: hidden;
  display: flex; flex-direction: column;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: filter .2s;
}
body.veiled .card, body.veiled .qr-box { filter: blur(18px); }
.band { display: block; width: 100%; height: auto; }
.band.bottom { transform: scaleY(-1); }
.card-inner {
  margin: 12px 16px; border: 2px solid var(--ochre);
  padding: 22px 18px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.families { margin: 0; font-family: Montserrat, sans-serif; font-weight: 700; font-size: 13px; letter-spacing: 2.4px; text-transform: uppercase; line-height: 1.6; }
.intro { margin: 6px 0 0; font-size: 19px; font-weight: 600; font-style: italic; line-height: 1.3; }
.names { display: flex; flex-direction: column; align-items: center; }
.script { margin: 0; font-family: 'Great Vibes', cursive; font-size: clamp(52px, 15vw, 72px); line-height: 1.05; color: var(--names); }
.amp { margin: 0; font-size: 26px; font-style: italic; font-weight: 600; line-height: 1; }
.ornament { width: 180px; height: 14px; color: var(--ochre-dark); }
.facts, .facts-only, .corner, .names-top { display: none; }
.date-row { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.date-side { flex: 0 1 100px; min-width: 0; white-space: nowrap; padding: 6px 0; border-top: 2px solid var(--ochre-dark); border-bottom: 2px solid var(--ochre-dark); font-family: Montserrat, sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 2px; }
.date-day { font-size: 60px; font-weight: 700; line-height: 1; }
.hour { margin: 6px 0 0; font-size: 22px; font-weight: 600; font-style: italic; }
.hour small { display: block; font-family: Montserrat, sans-serif; font-style: normal; font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--ochre-dark); margin-top: 2px; }
.label { margin: 0; font-family: Montserrat, sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 2.4px; color: var(--ochre-dark); }
.place { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.15; }
.place-detail { margin: 0; font-size: 18px; font-weight: 600; font-style: italic; }
.closing { margin: 0; font-size: 19px; font-weight: 600; font-style: italic; }
.watermark {
  position: absolute; inset: 0; pointer-events: none;
  background-repeat: repeat; opacity: .5; mix-blend-mode: multiply;
}

/* ---------- Panneaux ---------- */
.panel { background: var(--cream); border-radius: 14px; padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { margin: 0; font-size: 26px; font-weight: 700; }
.panel p { margin: 0; font-family: Montserrat, sans-serif; font-size: 15px; line-height: 1.5; color: var(--ink); }
.announce { background: #FFF6D8; border: 2px solid #D9A23A; border-radius: 14px; padding: 14px 16px; font-family: Montserrat, sans-serif; font-size: 15px; line-height: 1.5; white-space: pre-line; }
.announce strong { display: block; margin-bottom: 4px; }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; }
.countdown div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 4px; }
.countdown b { display: block; font-size: 32px; line-height: 1; }
.countdown span { font-family: Montserrat, sans-serif; font-size: 12px; color: var(--muted); }
.actions { display: grid; gap: 10px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 2px solid var(--ochre-dark);
  background: #fff; color: var(--ochre-dark); text-decoration: none; cursor: pointer;
  font-family: Montserrat, sans-serif; font-weight: 700; font-size: 15px;
}
.btn.primary { background: var(--ochre-dark); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.choice label { display: flex; align-items: center; justify-content: center; min-height: 52px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-family: Montserrat, sans-serif; font-weight: 700; font-size: 15px; cursor: pointer; text-align: center; padding: 6px; }
.choice input:checked + label { border-color: var(--ochre-dark); background: var(--tint); }
.choice input:focus-visible + label { outline: 3px solid var(--indigo); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; font-family: Montserrat, sans-serif; font-size: 14px; font-weight: 600; }
.field select, .field textarea, .field input {
  font: inherit; font-weight: 500; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.status { font-family: Montserrat, sans-serif; font-size: 15px; font-weight: 600; padding: 12px 14px; border-radius: 10px; background: #E6F0E3; color: var(--ok); }
.status.no { background: #F4E4E0; color: var(--danger); }
.qr-box { align-self: center; background: #fff; padding: 14px; border-radius: 12px; border: 1px solid var(--line); }
.qr-box svg, .qr-box img { display: block; width: 220px; height: 220px; }
.foot { text-align: center; color: var(--foot); font-family: Montserrat, sans-serif; font-size: 13px; line-height: 1.5; }
.center-msg { min-height: 80vh; padding: 16px; display: flex; align-items: center; justify-content: center; }
.center-msg .panel { text-align: center; max-width: 440px; }
.spinner { width: 36px; height: 36px; border: 4px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
/* ---------- Modèle « Nuit royale » : violet profond et or ---------- */
.royal {
  --cream: #F8F1E7; --ink: #2A1530; --ochre: #B8862F; --ochre-dark: #5A2770; --names: #5A2770;
  --muted: #5E4A63; --line: #DCCDE0; --tint: #EEDDF2; --foot: #E6D8EA; --indigo: #2A1236;
}
body.royal { background: radial-gradient(ellipse at 50% 0%, #4A1F5A 0%, #24102B 60%) fixed, #24102B; }
.royal .card-inner { border-color: var(--ochre); outline: 1px solid var(--ochre); outline-offset: -7px; padding-top: 26px; padding-bottom: 26px; }
.royal .ornament { color: var(--ochre); }
.royal .amp { color: var(--ochre); }
.royal .date-side { border-color: var(--ochre); }
.royal .label { color: var(--ochre); }

/* ---------- Modèle « Dan Fani violet » : papier gaufré, chiné en diagonale, ruban et fleurs ----------
   Le fond (assets/violet-fond.webp) est un faire-part complet sans texte. La carte garde ses proportions
   et toutes les tailles sont en cqw (% de la largeur de la carte) : le texte tombe au même endroit
   sur tous les téléphones, comme sur le faire-part imprimé. Si un texte est plus long, la carte s'allonge. */
.violet {
  --cream: #FCFAFE; --ink: #2E1650; --ochre: #7A52C7; --ochre-dark: #4E2E8F; --names: #3B1A62;
  --muted: #65587D; --line: #DED4F0; --tint: #EEE6FB; --foot: #2B1F45; --indigo: #A28CD3;
}
body.violet { background: linear-gradient(165deg, #D4C7EE 0%, #AE99DC 50%, #9580C8 100%) fixed, #AE99DC; }
.violet .card {
  container-type: inline-size;
  aspect-ratio: 1080 / 1935;
  background: url("/assets/violet-fond.webp") center / 100% 100% no-repeat, #F7F1FA;
}
.violet .band, .violet .corner, .violet .classic, .violet .facts-only { display: none; }
.violet .card-inner {
  border: 0; outline: 0; margin: 0; gap: 0;
  padding: 54px 36px 110px;              /* navigateurs anciens */
  padding: 16cqw 10.5cqw 34cqw;          /* bas : ruban et phrase de fin */
}
.violet .families {
  font-family: 'Cormorant Garamond', Georgia, serif; text-transform: none; letter-spacing: 0;
  font-size: 19px; font-size: 5.7cqw; font-weight: 500; line-height: 1.18; color: var(--ink);
}
.violet .families b { font-weight: 700; }
.violet .fam-lead { display: block; }
.violet .intro { margin-top: 12px; margin-top: 4cqw; font-size: 18px; font-size: 5.5cqw; font-weight: 600; line-height: 1.2; color: var(--ink); }
.violet .ornament { color: #8F72CC; width: 60%; height: auto; }
.violet .names-top { display: block; margin-top: 12px; margin-top: 4cqw; }
.violet .names {
  margin-top: 6px; margin-top: 2cqw;
  flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline;
  column-gap: 8px; column-gap: 2.4cqw;
}
.violet .script { font-size: 54px; font-size: 16.5cqw; color: var(--names); line-height: 1.1; }
.violet .amp { font-family: 'Cormorant Garamond', Georgia, serif; font-style: normal; font-weight: 600; font-size: 38px; font-size: 11.5cqw; color: #A88BDB; margin: 0; }
.violet .names + .ornament { margin-top: 6px; margin-top: 2cqw; }
.violet .facts { display: grid; margin-top: 14px; margin-top: 4.5cqw; gap: 10px; gap: 3.2cqw; width: 100%; max-width: 66cqw; text-align: left; }
.violet .fact { grid-template-columns: 34px 1fr; grid-template-columns: 10cqw 1fr; gap: 12px; gap: 4cqw; }
.violet .fact > svg { width: 100%; height: auto; color: var(--ink); }
.violet .fact > div { border-left: 2px solid #A88BDB; padding: 2px 0 2px 12px; padding-left: 4cqw; }
.violet .fact span { display: none; }
.violet .fact b, .violet .fact i {
  display: block; white-space: pre-line; font-style: normal; font-weight: 600; color: var(--ink);
  font-size: 19px; font-size: 5.8cqw; line-height: 1.15;
}
.violet .fact small { color: var(--ochre); font-size: 11px; font-size: 3.4cqw; }
.violet .closing {                        /* sous le ruban, comme sur le faire-part imprimé */
  position: absolute; z-index: 1; margin: 0;
  left: 12%; right: 12%; bottom: 20px; height: 44px;
  left: 12cqw; right: 12cqw; bottom: 6.5cqw; height: 13.5cqw;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-size: 5.1cqw; line-height: 1.15; color: var(--ink);
}
.violet .panel { box-shadow: 0 1px 0 rgba(78, 46, 143, .08); }

/* ---------- Modèle « Ivoire & or » : parchemin, frise dorée sur le côté, fleurs ---------- */
.or {
  --cream: #F7EEDD; --ink: #3A2012; --ochre: #B5822C; --ochre-dark: #6B3A14; --names: #4A2210;
  --muted: #6B5240; --line: #E0CFAE; --tint: #F1E0C2; --foot: #EBDCC4;
}
body.or { background: #2E1B0F; }
.or .card {
  background: radial-gradient(ellipse at 55% 40%, #FBF5E9 0%, #F3E6CC 65%, #E8D5B0 100%);
}
.or .card::before { /* frise tissée dorée sur le côté gauche */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 34px; z-index: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='40'%3E%3Crect width='34' height='40' fill='%236A3512'/%3E%3Crect x='14' width='20' height='40' fill='%23542910'/%3E%3Ccircle cx='7' cy='10' r='4.5' fill='none' stroke='%23D9A94A' stroke-width='1.4'/%3E%3Ccircle cx='7' cy='10' r='1.6' fill='%23D9A94A'/%3E%3Ccircle cx='7' cy='30' r='4.5' fill='none' stroke='%23D9A94A' stroke-width='1.4'/%3E%3Ccircle cx='7' cy='30' r='1.6' fill='%23D9A94A'/%3E%3Crect x='14' width='1.5' height='40' fill='%23D9A94A'/%3E%3Crect x='32' width='2' height='40' fill='%23D9A94A'/%3E%3Cpolygon points='24,3 31,20 24,37 17,20' fill='none' stroke='%23D9A94A' stroke-width='1.6'/%3E%3Cpolygon points='24,13 27,20 24,27 21,20' fill='%23E8C46E'/%3E%3C/svg%3E") repeat-y;
}
.or .band { display: none; }
.or .card-inner {
  position: relative; z-index: 1;
  margin: 14px 14px 14px 46px; padding: 84px 14px 64px;
  border: 1.5px solid var(--ochre); outline: 1px solid var(--ochre); outline-offset: -6px;
  gap: 18px;
}
.or .corner { display: block; position: absolute; z-index: 2; width: 156px; height: 156px; pointer-events: none; }
.or .corner svg { width: 100%; height: 100%; display: block; }
.or .corner.tr { top: -2px; right: -2px; }
.or .corner.bl { bottom: -2px; left: 4px; transform: rotate(180deg); }
.or .families { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 21px; font-weight: 700; letter-spacing: 0; text-transform: none; line-height: 1.25; }
.or .intro { font-size: 18px; }
.or .amp { font-family: 'Great Vibes', cursive; font-style: normal; font-weight: 400; font-size: 46px; color: var(--ochre); margin: -6px 0; }
.or .ornament { color: var(--ochre); }
.or .classic { display: none; }
.or .facts { display: grid; gap: 14px; width: 100%; max-width: 300px; text-align: left; }
.or .facts-only { display: block; }
.fact { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 12px; }
.fact > svg { width: 38px; height: 38px; color: var(--names); }
.fact > div { border-left: 2px solid var(--ochre); padding: 2px 0 2px 14px; }
.fact span { display: block; font-size: 17px; font-weight: 600; }
.fact b { display: block; font-size: 23px; font-weight: 700; line-height: 1.15; }
.fact i { display: block; font-size: 18px; font-weight: 600; }
.fact small { display: block; font-family: Montserrat, sans-serif; font-size: 12px; font-weight: 600; color: var(--ochre-dark); }
.or .closing { font-size: 20px; color: var(--names); }

.hidden { display: none !important; }
@media print { body { display: none; } }
