:root {
  --nuit: #2a1245;
  --prune: #5b2a6e;
  --corail: #e8614f;
  --soleil: #ffb648;
  --or: #ffd76a;
  --creme: #fff6e4;
  --foret: #1f5a4c;
  --encre: #3a2335;
}

* { box-sizing: border-box; margin: 0; }

html, body { min-height: 100%; }

body {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 600;
  color: var(--encre);
  background: var(--nuit);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Ciel de coucher de soleil + collines */
.ciel {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(circle at 50% 78%, #fff1b8 0 7%, rgba(255, 214, 106, .55) 8% 16%, transparent 34%),
    linear-gradient(180deg, var(--nuit) 0%, var(--prune) 32%, var(--corail) 62%, var(--soleil) 82%, #ffd98a 100%);
}
.ciel::after {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -6vh; height: 26vh;
  background:
    radial-gradient(ellipse 60% 100% at 25% 100%, #173f3a 0 99%, transparent 100%),
    radial-gradient(ellipse 70% 80% at 80% 100%, #1f5a4c 0 99%, transparent 100%);
}

/* Feuilles emportées par le vent */
.feuilles { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.feuille {
  position: absolute; left: -12vw; font-size: 1.6rem; opacity: .85;
  animation: vole linear infinite;
}
@keyframes vole {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(30vw, -6vh) rotate(160deg); }
  50%  { transform: translate(60vw, 5vh) rotate(320deg); }
  75%  { transform: translate(90vw, -8vh) rotate(500deg); }
  100% { transform: translate(125vw, 2vh) rotate(720deg); }
}

main {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}

.carte {
  width: 100%; max-width: 560px;
  background: var(--creme);
  border-radius: 28px;
  padding: 28px 22px 26px;
  box-shadow: 0 18px 50px rgba(20, 5, 40, .45), inset 0 0 0 3px rgba(255, 182, 72, .55);
  text-align: center;
  animation: apparait .6s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes apparait { from { opacity: 0; transform: translateY(24px) scale(.96); } }

.embleme { font-size: 4.2rem; line-height: 1; display: block; margin-bottom: 8px; animation: balance 3.5s ease-in-out infinite; }
@keyframes balance { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

.surtitre {
  font-size: .85rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--corail); font-weight: 800; margin-bottom: 6px;
}
h1 {
  font-family: "Fraunces", Georgia, serif; font-weight: 800;
  font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.1;
  color: var(--prune); margin-bottom: 16px; text-wrap: balance;
}
p { font-size: 1.22rem; line-height: 1.5; margin-bottom: 14px; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
strong { color: var(--foret); font-weight: 800; }

.indice {
  background: #fff; border: 3px dashed var(--soleil); border-radius: 20px;
  padding: 16px; margin: 18px 0 4px;
  font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.3rem; color: var(--prune);
}
.indice small { display: block; font-family: "Nunito", sans-serif; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--corail); font-weight: 800; margin-bottom: 6px; }

.regles { text-align: left; list-style: none; padding: 0; margin: 6px 0 14px; }
.regles li { font-size: 1.15rem; line-height: 1.4; padding: 8px 0 8px 40px; position: relative; }
.regles li span { position: absolute; left: 0; top: 6px; font-size: 1.5rem; }

button {
  font: inherit; font-weight: 800; font-size: 1.2rem; cursor: pointer;
  border: 0; border-radius: 999px; padding: 16px 26px; margin-top: 12px; width: 100%;
  color: #fff; background: linear-gradient(180deg, var(--corail), #c9452f);
  box-shadow: 0 6px 0 #8e2c1d, 0 12px 20px rgba(142, 44, 29, .3);
  transition: transform .08s, box-shadow .08s;
}
button:active { transform: translateY(4px); box-shadow: 0 2px 0 #8e2c1d; }
button.doux { background: linear-gradient(180deg, #2f8a73, var(--foret)); box-shadow: 0 6px 0 #123a31, 0 12px 20px rgba(18, 58, 49, .3); }
button.doux:active { box-shadow: 0 2px 0 #123a31; }
button.discret { background: transparent; color: var(--prune); box-shadow: none; text-decoration: underline; font-size: 1rem; padding: 10px; }

input {
  font: inherit; font-weight: 800; font-size: 1.7rem; text-align: center; text-transform: uppercase;
  width: 100%; padding: 14px; margin-top: 6px;
  border: 3px solid var(--soleil); border-radius: 18px; background: #fff; color: var(--prune); outline: none;
}
input:focus { border-color: var(--corail); }
.secoue { animation: secoue .4s; }
@keyframes secoue { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.erreur { color: #c9452f; font-weight: 800; min-height: 1.6em; margin-top: 10px; font-size: 1.1rem; }

/* Liens de la page souvenir */
.liens { list-style: none; padding: 0; margin: 0; text-align: left; font-family: "Nunito", sans-serif; }
.liens li + li { border-top: 2px dotted #f0d9a8; }
.liens a { display: block; position: relative; padding: 12px 4px 12px 44px; text-decoration: none; color: var(--encre); }
.liens a span { position: absolute; left: 2px; top: 12px; font-size: 1.6rem; }
.liens a b { display: block; font-size: 1.08rem; font-weight: 800; color: var(--prune); text-decoration: underline; text-decoration-color: var(--soleil); text-underline-offset: 3px; }
.liens a em { display: block; font-style: normal; font-size: .92rem; font-weight: 600; line-height: 1.35; margin-top: 2px; }

/* Chrono */
.chrono {
  font-family: "Fraunces", Georgia, serif; font-weight: 800; font-size: 7rem; line-height: 1;
  color: var(--corail); margin: 10px 0; font-variant-numeric: tabular-nums;
}
.chrono.fin { color: var(--foret); }

/* Éclats à cocher */
.eclats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 16px 0 6px; }
.eclat {
  aspect-ratio: 1; width: auto; margin: 0; padding: 0; font-size: 1.9rem; border-radius: 50%;
  background: #eadfcb; box-shadow: inset 0 3px 6px rgba(0, 0, 0, .15); filter: grayscale(1); opacity: .55;
}
.eclat:active { transform: scale(.92); box-shadow: inset 0 3px 6px rgba(0, 0, 0, .15); }
.eclat.trouve {
  background: radial-gradient(circle at 35% 30%, #fff3b0, var(--or) 45%, #e39a1c);
  box-shadow: 0 4px 0 #b3740f, 0 0 18px rgba(255, 215, 106, .9); filter: none; opacity: 1;
  animation: pop .35s cubic-bezier(.2, .9, .3, 1.6);
}
@keyframes pop { from { transform: scale(.4) rotate(-90deg); } }

/* Final */
.ballons { font-size: 2.6rem; letter-spacing: .1em; margin: 8px 0; }
.confetti { position: fixed; top: -5vh; font-size: 1.8rem; z-index: 5; pointer-events: none; animation: tombe linear forwards; }
@keyframes tombe { to { transform: translateY(115vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  .feuille, .embleme, .carte { animation: none; }
}
