:root {
  --nuit: #0b2234;
  --creme: #f7efe2;
  --creme-2: #e9d9bd;
  --texte-doux: #d6e3ee;
  --or: #e2b766;
  --or-clair: #f3d79c;
  --rouge: #c9302a;
  --rouge-f: #8e1d1a;
  --sapin: #36533b;
  --encre: #3a1a14;
  --encre-douce: #7d5c4c;
  --ok: #4f7d55;
  --titre: 'Cormorant Garamond', Garamond, Georgia, serif;
  --plume: 'Pinyon Script', 'Cormorant Garamond', cursive;
  --sans: 'Jost', system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; background: var(--nuit); }
body {
  margin: 0; min-height: 100svh; font-family: var(--sans); font-weight: 400; color: var(--creme);
  background: linear-gradient(180deg, #04263a 0%, #094865 32%, #094865 100%); background-attachment: fixed;
  overflow-x: clip; -webkit-tap-highlight-color: transparent;
}

/* ---------- Décor : paysage SVG ---------- */
#decor { position: fixed; inset: 0; z-index: 0; opacity: 0; transition: opacity 1s ease; }
#decor.pret { opacity: 1; }
#decor svg { width: 100%; height: 100%; display: block; animation: respire-decor 26s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes respire-decor { to { transform: scale(1.035); } }
.voile { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 22, 36, .72) 0%, rgba(4, 22, 36, .35) 38%, rgba(4, 22, 36, 0) 60%); }
#decor .fumee { opacity: .8; animation: fumee 6s ease-in-out infinite; transform-box: fill-box; transform-origin: 30% 100%; }
@keyframes fumee { 50% { opacity: .55; transform: skewX(-3deg) scaleY(1.03); } }
#decor .fenetre { animation: feu 3.1s ease-in-out infinite; }
#decor .fenetre.f1 { animation-delay: -1.2s; } #decor .fenetre.f2 { animation-delay: -.6s; } #decor .fenetre.f3 { animation-delay: -2s; }
@keyframes feu { 0%, 100% { opacity: 1; } 18% { opacity: .82; } 40% { opacity: .97; } 63% { opacity: .78; } 80% { opacity: .95; } }
#decor .ampoule { animation: scintille 2.4s ease-in-out infinite; }
#decor .a1 { animation-delay: -.5s; animation-duration: 3.1s; } #decor .a2 { animation-delay: -1.1s; animation-duration: 2.2s; }
#decor .a3 { animation-delay: -1.7s; animation-duration: 2.8s; } #decor .a4 { animation-delay: -.2s; animation-duration: 3.6s; }
@keyframes scintille { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

#neige, #confettis { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#neige { z-index: 2; }
#confettis { z-index: 40; }

/* ---------- Mise en page ---------- */
main {
  position: relative; z-index: 3; width: 100%; max-width: 440px; margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) 20px 28px; min-height: 100svh; display: flex; flex-direction: column;
}
.surtitre { text-align: center; font-weight: 500; font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--or-clair); margin: 0 0 6px; }
h1 {
  font-family: var(--titre); font-weight: 500; font-style: italic; font-size: clamp(42px, 12vw, 54px); line-height: 1; text-align: center;
  margin: 0 0 12px; color: var(--creme); letter-spacing: -.01em; text-shadow: 0 2px 18px rgba(0, 20, 35, .6);
}
.chapeau { text-align: center; color: var(--texte-doux); font-size: 16px; line-height: 1.55; margin: 0 auto 4px; max-width: 30ch; font-weight: 300; text-shadow: 0 1px 10px rgba(0, 20, 35, .8); }

/* ---------- Paquet (SVG en calques) ---------- */
.scene { position: relative; height: 250px; margin: 6px -20px 0; display: grid; place-items: center; }
.lueur {
  position: absolute; left: 50%; top: 50%; width: 280px; height: 280px; margin: -140px 0 0 -140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 140, .38) 0%, rgba(255, 170, 80, .12) 45%, transparent 70%);
  animation: respire 4s ease-in-out infinite;
}
@keyframes respire { 50% { transform: scale(1.1); opacity: .7; } }
.cadeau { position: relative; width: 180px; border: 0; background: none; padding: 0; cursor: pointer; outline: none; animation: flotte 3.2s ease-in-out infinite; }
.cadeau:disabled { cursor: default; }
.cadeau:focus-visible { outline: 2px solid var(--or-clair); outline-offset: 10px; border-radius: 8px; }
.cadeau svg { width: 100%; display: block; overflow: visible; filter: drop-shadow(0 18px 18px rgba(0, 15, 30, .45)); }
@keyframes flotte { 50% { transform: translateY(-8px); } }
#couvercle, #eclats { transform-box: fill-box; }
#couvercle { transform-origin: 50% 100%; }
#eclats { transform-origin: 50% 100%; opacity: 0; }

.secoue { animation: secoue .5s ease-in-out 3 !important; }
@keyframes secoue { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-5deg) translateY(-2px); } 40% { transform: rotate(4deg) translateY(-4px); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
.secoue #couvercle { animation: sautille .25s ease-in-out 6 alternate; }
@keyframes sautille { to { transform: translateY(-22px); } }
.ouvert .cadeau { animation: none; }
.ouvert #couvercle { animation: envol 1.4s cubic-bezier(.2, .75, .3, 1) forwards; }
@keyframes envol { 0% { transform: none; } 35% { transform: translate(-40px, -330px) rotate(-22deg); } 100% { transform: translate(-520px, -150px) rotate(-75deg); opacity: 0; } }
.ouvert #eclats { animation: eclats 1.6s ease-out .1s forwards; }
@keyframes eclats { 0% { opacity: 0; transform: scale(.2) translateY(200px); } 25% { opacity: 1; } 60% { opacity: 1; transform: scale(1.5) translateY(-120px); } 100% { opacity: 0; transform: scale(1.7) translateY(-160px); } }
.faisceau {
  position: absolute; left: 50%; top: -40px; width: 240px; height: 230px; margin-left: -120px; opacity: 0; pointer-events: none;
  background: linear-gradient(0deg, rgba(255, 232, 170, .7), rgba(255, 232, 170, 0));
  clip-path: polygon(28% 100%, 72% 100%, 100% 0, 0 0); filter: blur(8px); transform-origin: 50% 100%;
}
.ouvert .faisceau { animation: faisceau 1.8s ease-out .15s forwards; }
@keyframes faisceau { 0% { opacity: 0; transform: scaleY(.2); } 30% { opacity: 1; } 100% { opacity: 0; transform: scaleY(1.25); } }
.disparait { animation: disparait .6s ease-in forwards; }
@keyframes disparait { to { opacity: 0; transform: scale(.94); } }

.invite { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0; font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--or-clair); font-weight: 500; text-shadow: 0 1px 8px rgba(0, 20, 35, .9); }
.invite::before, .invite::after { content: ''; width: 28px; height: 1px; background: currentColor; opacity: .6; }
.invite span { animation: clignote 2.6s ease-in-out infinite; }
@keyframes clignote { 50% { opacity: .45; } }

/* ---------- Révélation ---------- */
.revelation { text-align: center; margin: 14px 0 0; }
.revelation .petit { font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--or-clair); margin: 0; font-weight: 500; }
.revelation .nom {
  font-family: var(--plume); font-weight: 400; font-size: clamp(68px, 21vw, 96px); line-height: 1.2; color: #fff8ec; margin: 4px 0 0;
  word-break: break-word; padding: 0 8px; text-shadow: 0 0 26px rgba(255, 200, 120, .55), 0 2px 14px rgba(0, 20, 35, .6);
}
.revelation .chut { font-family: var(--titre); font-style: italic; font-size: 21px; color: var(--texte-doux); margin: 0; text-shadow: 0 1px 10px rgba(0, 20, 35, .8); }
.arrive { animation: arrive 1.1s cubic-bezier(.2, .9, .3, 1) both; }
.arrive-2 { animation: arrive 1.1s cubic-bezier(.2, .9, .3, 1) .3s both; }
.arrive-3 { animation: arrive 1.1s cubic-bezier(.2, .9, .3, 1) .6s both; }
@keyframes arrive { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }

/* ---------- Infos : carte givrée ---------- */
.infos {
  margin: 22px 0 0; padding: 18px 16px 16px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .08));
  border: 1px solid rgba(255, 255, 255, .28); box-shadow: 0 20px 40px -18px rgba(0, 20, 40, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.infos .titre-infos { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--or-clair); font-weight: 500; margin: 0; }
.infos .quand { font-family: var(--titre); font-size: 25px; font-weight: 600; margin: 2px 0 0; color: #fff; }
.rebours { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.rebours .case { background: rgba(5, 25, 40, .42); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px; padding: 10px 0 8px; }
.rebours .n { font-family: var(--titre); font-weight: 600; font-size: 34px; line-height: 1; font-variant-numeric: lining-nums tabular-nums; color: #fff; }
.rebours .u { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--texte-doux); margin-top: 5px; }
.budget { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .16); }
.budget .lbl { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--or-clair); font-weight: 500; }
.budget .val { font-family: var(--titre); font-size: 30px; font-weight: 600; color: #fff; line-height: 1; }
.tic { animation: tic .5s ease-out; }
@keyframes tic { from { opacity: .3; transform: translateY(-3px); } }

.pied { padding-top: 14px; text-align: center; }
.lien-discret {
  background: none; border: 0; color: var(--creme); font: inherit; font-size: 14px; letter-spacing: .04em; text-shadow: 0 1px 8px rgba(0, 20, 35, .9);
  text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .45); text-underline-offset: 4px; cursor: pointer; padding: 10px;
}

/* ---------- Admin ---------- */
.carte {
  position: relative; background: linear-gradient(180deg, #fbf4e8, var(--creme) 60%, var(--creme-2));
  color: var(--encre); border-radius: 18px; padding: 22px 18px 20px; margin-bottom: 16px;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .6);
}
.carte h2 {
  font-family: var(--titre); font-weight: 600; font-size: 26px; margin: 0 0 12px; color: var(--rouge-f);
  display: flex; align-items: baseline; gap: 10px; line-height: 1.1;
}
.num { font-family: var(--titre); font-style: italic; font-weight: 500; color: var(--or); font-size: 26px; }
.aide { color: var(--encre-douce); font-size: 14px; line-height: 1.5; margin: -4px 0 12px; }
label.champ { display: block; font-weight: 500; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--encre-douce); margin: 0 0 14px; }
label.champ span { display: block; margin-bottom: 6px; }
input, select {
  width: 100%; font: inherit; font-size: 16px; letter-spacing: 0; text-transform: none; color: var(--encre);
  background: #fffdf9; border: 1px solid #d9c6a6; border-radius: 12px; padding: 12px 14px;
  appearance: none; -webkit-appearance: none; min-height: 48px;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--encre-douce) 50%), linear-gradient(135deg, var(--encre-douce) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus { outline: none; border-color: var(--sapin); box-shadow: 0 0 0 3px rgba(54, 83, 59, .18); }
.ligne { display: flex; gap: 8px; align-items: stretch; }
.ligne > * { flex: 1; min-width: 0; }
.ligne > .btn { flex: none; }

.btn {
  font: inherit; font-weight: 500; font-size: 15px; letter-spacing: .04em; border: 0; border-radius: 12px; padding: 12px 18px; min-height: 48px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, filter .2s; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-rouge { background: linear-gradient(180deg, #d23a32, var(--rouge-f)); color: #fff; box-shadow: 0 8px 18px -8px rgba(142, 29, 26, .9); }
.btn-vert { background: linear-gradient(180deg, #46684a, var(--sapin)); color: #fff; box-shadow: 0 8px 18px -8px rgba(30, 50, 33, .9); }
.btn-wa { background: #1f8f4f; color: #fff; }
.btn-wa svg { width: 18px; height: 18px; flex: none; }
.btn-clair { background: transparent; color: var(--encre); border: 1px solid #cdb58e; }
.btn-gros { width: 100%; font-size: 15px; min-height: 54px; letter-spacing: .12em; text-transform: uppercase; }

.liste { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.liste li {
  display: flex; align-items: center; gap: 10px; background: #fffaf2; border: 1px solid #eadbc0; border-radius: 12px; padding: 8px 8px 8px 14px;
  animation: pop .3s ease-out both;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }
.liste.puces { display: flex; flex-wrap: wrap; }
.liste.puces li { padding: 4px 4px 4px 14px; border-radius: 99px; gap: 2px; }
.liste .qui { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--encre-douce); cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.x svg { width: 12px; height: 12px; }
.x:active { background: #f0e2c9; }
.etat { font-size: 12px; color: var(--encre-douce); display: block; font-weight: 400; }
.etat.vu { color: var(--ok); }
.actions { display: flex; gap: 6px; flex: none; }
.actions .btn { min-height: 40px; padding: 8px 12px; font-size: 14px; border-radius: 10px; letter-spacing: 0; }
.vide { color: var(--encre-douce); font-style: italic; font-size: 15px; margin: 4px 0 0; }
.compteur { margin-left: auto; font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--encre-douce); }
.croix { color: var(--rouge); margin: 0 6px; font-weight: 400; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 160%);
  background: var(--encre); color: var(--creme); padding: 12px 18px; border-radius: 12px; font-weight: 500; font-size: 15px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5); transition: transform .35s cubic-bezier(.2, 1.2, .4, 1); max-width: calc(100% - 32px); text-align: center;
}
.toast.on { transform: translate(-50%, 0); }
.toast.err { background: var(--rouge-f); }
.note { background: #f6ead3; border-left: 3px solid var(--or); border-radius: 8px; padding: 10px 12px; font-size: 14px; color: var(--encre); line-height: 1.5; margin: 0; }
.cache { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
