:root {
  --vert-fonce: #062b1f;
  --rouge: #a31621;
  --rouge-fonce: #6e0d16;
  --or: #d4af37;
  --creme: #fff8e7;
  --texte: #fdf6e3;
  --ombre: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--texte);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(212, 175, 55, 0.18), transparent 60%),
    radial-gradient(1000px 500px at 90% 110%, rgba(163, 22, 33, 0.35), transparent 60%),
    linear-gradient(160deg, var(--vert-fonce) 0%, #04150e 55%, #3d0a10 100%);
  min-height: 100vh;
}

#neige {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.entete, main, .pied { position: relative; z-index: 1; }

.entete {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  padding: 1.2rem clamp(1rem, 4vw, 3rem);
  border-bottom: 3px solid var(--or);
  background: rgba(0, 0, 0, 0.25);
}

.marque {
  display: inline-block;
  background: #ffffff;
  border: 2px solid var(--or);
  border-radius: 14px;
  padding: 0.5rem 1rem;
  box-shadow: 0 4px 12px var(--ombre);
}

.logo { height: clamp(56px, 8vw, 76px); width: auto; display: block; }
.logo-petit { height: 30px; width: auto; display: inline-block; background: #fff; border-radius: 8px; padding: 4px 8px; }

.titre-site h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  color: var(--or);
  text-shadow: 0 2px 8px var(--ombre);
  letter-spacing: 0.02em;
}

.sous-titre { margin: 0.2rem 0 0; opacity: 0.9; }

.compte { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.etat-compte { font-size: 0.95rem; opacity: 0.95; }

main {
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.bandeau-simulation {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
  background: #b8860b;
  color: #1d1200;
  font-weight: 700;
  padding: 0.45rem 1rem;
  font-size: 0.92rem;
}

.bandeau-simulation[hidden] { display: none; }

.message-jour {
  text-align: center;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  color: var(--or);
  font-weight: 600;
  margin: 0.5rem 0 0.2rem;
}

.consigne {
  text-align: center;
  opacity: 0.85;
  max-width: 720px;
  margin: 0.4rem auto 1.6rem;
  font-size: 0.95rem;
}

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

/* Cases = cadeaux emballés (papier rayé + ruban doré + noeud) */
.case {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(212, 175, 55, 0.7);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  background: repeating-linear-gradient(45deg, #b31b28 0 16px, #8e1420 16px 32px);
  color: var(--texte);
  font: inherit;
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 14px var(--ombre);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.case:nth-child(3n+2) { background: repeating-linear-gradient(45deg, #0f6a47 0 16px, #0a4a31 16px 32px); }
.case:nth-child(3n) { background: repeating-linear-gradient(45deg, #a8842a 0 16px, #7d6114 16px 32px); }

.case::before, .case::after {
  content: "";
  position: absolute;
  z-index: 1;
  background: linear-gradient(180deg, #eed27a, #c9a227);
  transition: opacity 0.45s ease 0.1s;
}

.case::before { left: 50%; top: 0; bottom: 0; width: 16px; margin-left: -8px; }
.case::after { top: 50%; left: 0; right: 0; height: 16px; margin-top: -8px; }

.case .interieur {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.4rem;
  text-align: center;
}

.case .noeud { font-size: 1.5rem; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }

.case .numero {
  background: var(--creme);
  color: #7c1019;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
  border-radius: 6px;
  padding: 0.05rem 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.case .etiquette {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--creme);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.case:hover { transform: translateY(-4px) rotate(-1deg); }

.case.dispo { box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4), 0 5px 14px var(--ombre); }

.case.verrouille { cursor: not-allowed; filter: grayscale(0.8) brightness(0.7); }
.case.verrouille::before, .case.verrouille::after { background: #8f8f8f; }
.case.verrouille .numero { background: rgba(255, 248, 231, 0.55); color: rgba(40, 20, 20, 0.6); }

.case.aujourdhui { animation: pulsation 1.6s ease-in-out infinite; }

@keyframes pulsation {
  0%, 100% { box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.35), 0 6px 18px var(--ombre); }
  50% { box-shadow: 0 0 0 9px rgba(212, 175, 55, 0.55), 0 6px 22px var(--ombre); }
}

/* Cadeau déballé : le papier et le ruban disparaissent, la boîte s'ouvre */
.case.ouvert {
  border-color: #fff3c4;
  background: linear-gradient(180deg, #f3d878, #c9a227);
  color: #2b1d00;
  cursor: pointer;
}

.case.ouvert::before, .case.ouvert::after { opacity: 0; }
.case.ouvert .numero { background: #7c1019; color: var(--creme); }
.case.ouvert .titre-case { font-size: 0.78rem; font-weight: 700; line-height: 1.2; }

.case.pop { animation: deballer 0.7s ease; }

@keyframes deballer {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.18) rotate(-5deg); }
  70% { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.case.secoue { animation: secousse 0.4s ease; }

@keyframes secousse {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-principal {
  background: linear-gradient(180deg, #c9202f, var(--rouge-fonce));
  color: var(--creme);
  border: 2px solid var(--or);
}

.btn-secondaire {
  background: transparent;
  color: var(--or);
  border: 2px solid var(--or);
}

.btn:hover { filter: brightness(1.12); }

.modale {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 1rem;
}

.modale[hidden] { display: none; }

.modale-carte {
  position: relative;
  background: linear-gradient(180deg, #0d3b2a, #072015);
  border: 3px solid var(--or);
  border-radius: 16px;
  padding: 1.6rem 1.6rem 1.4rem;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.modale-cadeau-carte { max-width: 520px; text-align: center; }

.modale-carte h2 { margin: 0 0 0.4rem; color: var(--or); }

.modale-texte { margin: 0.2rem 0 0.9rem; opacity: 0.92; }
.modale-texte.petit { font-size: 0.82rem; opacity: 0.75; margin-bottom: 0; }

.fermer {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  background: none;
  border: none;
  color: var(--or);
  font-size: 1.2rem;
  cursor: pointer;
}

.onglets { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; }

.onglet {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  color: var(--texte);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 8px;
  padding: 0.45rem;
  cursor: pointer;
  font: inherit;
}

.onglet.actif { background: var(--or); color: #2b1d00; font-weight: 700; }

.form { display: flex; flex-direction: column; gap: 0.7rem; }

.form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }

.form input {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.6);
  background: rgba(255, 248, 231, 0.95);
  color: #222;
  font: inherit;
}

.separation {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0;
  opacity: 0.8;
  font-size: 0.85rem;
}

.separation::before, .separation::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(212, 175, 55, 0.5);
}

#bouton-google { display: flex; justify-content: center; min-height: 44px; }

.erreur { color: #ff9b9b; min-height: 1.2em; margin: 0.6rem 0 0; font-size: 0.9rem; }

.numero-cadeau { margin: 0; color: var(--or); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.85rem; }

.action-cadeau { margin: 1rem 0; display: flex; justify-content: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  background: rgba(6, 43, 31, 0.95);
  border: 2px solid var(--or);
  color: var(--texte);
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  z-index: 20;
  box-shadow: 0 8px 24px var(--ombre);
  max-width: 90vw;
  text-align: center;
}

.toast[hidden] { display: none; }

.pied {
  text-align: center;
  padding: 1.6rem 1rem 2.2rem;
  border-top: 3px solid var(--or);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
}

.pied a { color: var(--or); }
.liens-legaux { margin: 0.3rem 0 0; }

/* Pages légales */
.page-legale main { max-width: 860px; }
.page-legale h1 { color: var(--or); border-bottom: 2px solid var(--or); padding-bottom: 0.4rem; }
.page-legale h2 { color: var(--or); margin-top: 1.6rem; font-size: 1.15rem; }
.page-legale p, .page-legale li { line-height: 1.65; }
.page-legale .retour { display: inline-block; margin-bottom: 1rem; color: var(--or); }

@media (max-width: 640px) {
  .logo { height: 46px; }
  .compte { margin-left: 0; }
  .grille { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0.6rem; }
  .case { min-height: 104px; padding: 0.6rem 0.3rem; }
  .case .numero { font-size: 1.4rem; }
}
