/* Jeu de Noël Maison Phare — charte : marine #0B2545, gris #E6E8EA, serif espacée */

:root {
  --marine: #0B2545;
  --marine-fonce: #071A33;
  --marine-clair: #163A66;
  --gris: #E6E8EA;
  --blanc: #FFFFFF;
  --caramel: #C8954A;
  --caramel-clair: #E9C891;
  --rouge: #C0392B;
  --texte-carte: #0B2545;
  --texte-doux: #4A5B70;
  --serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--marine);
  color: var(--blanc);
  font-family: var(--sans);
  line-height: 1.5;
  overflow-x: hidden;
  font-variant-numeric: lining-nums; /* chiffres alignés : « 10 » et non « IO » en Cormorant */
}

/* Fond : dégradé nuit + bande diagonale du logo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(150deg, transparent 38%, rgba(230, 232, 234, 0.045) 38%, rgba(230, 232, 234, 0.045) 60%, transparent 60%),
    radial-gradient(120% 75% at 50% 0%, var(--marine-clair) 0%, var(--marine) 55%, var(--marine-fonce) 100%);
}

.neige {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.7;
}

a { color: inherit; }

/* Rogne le faisceau du phare (sinon la page déborde en largeur sur mobile).
   « clip » préserve le position: sticky de la roue sur grand écran. */
.habillage { position: relative; overflow: hidden; overflow: clip; }

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 24px;
  display: grid;
  gap: 18px;
  grid-template-areas: "entete" "scene" "jeu";
}

/* ── En-tête ─────────────────────────────────────────── */
.entete { grid-area: entete; text-align: center; }
.logo { width: 132px; height: auto; display: block; margin: 0 auto 14px; }
.surtitre {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--caramel-clair);
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.15rem, 8.4vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
}
h1 em { font-style: italic; color: var(--caramel-clair); font-weight: 600; }
.intro {
  margin: 12px auto 0;
  max-width: 30em;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
}
.intro strong { color: var(--blanc); }

/* ── Roue ────────────────────────────────────────────── */
.scene {
  grid-area: scene;
  position: relative;
  display: grid;
  place-items: center;
  padding: 10px 0 6px;
  isolation: isolate;
}
.faisceau {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180vmax;
  height: 180vmax;
  margin: -90vmax 0 0 -90vmax;
  z-index: -1;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 236, 196, 0.16) 10deg,
    transparent 26deg,
    transparent 180deg,
    rgba(255, 236, 196, 0.09) 190deg,
    transparent 206deg
  );
  -webkit-mask-image: radial-gradient(circle, #000 8%, transparent 42%);
  mask-image: radial-gradient(circle, #000 8%, transparent 42%);
  animation: balayage 16s linear infinite;
}
@keyframes balayage { to { transform: rotate(360deg); } }

.roue-cadre {
  position: relative;
  width: min(88vw, 400px);
  aspect-ratio: 1;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
}
.roue { position: absolute; inset: 0; }
.roue-couche { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.roue-rotor { will-change: transform; transform-origin: 50% 50%; }
.roue-libelle {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 27px;
  dominant-baseline: middle;
}
.roue-libelle-petit {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 1.4px;
  dominant-baseline: middle;
}
.ampoule { fill: #FFF1D0; }
.ampoule.a { animation: scintille 1.6s ease-in-out infinite; }
.ampoule.b { animation: scintille 1.6s ease-in-out 0.8s infinite; }
@keyframes scintille { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.roue-cadre.tourne .ampoule { animation-duration: 0.35s; }

.pointeur {
  position: absolute;
  left: 50%;
  top: -3.5%;
  width: 12%;
  transform: translateX(-50%);
  transform-origin: 50% 32%;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4));
  z-index: 2;
}
.pointeur.tic { animation: tic 0.13s ease-out; }
@keyframes tic {
  0% { transform: translateX(-50%) rotate(-16deg); }
  100% { transform: translateX(-50%) rotate(0); }
}

/* ── Formulaire ──────────────────────────────────────── */
.zone-jeu { grid-area: jeu; display: grid; gap: 12px; }

.carte {
  background: var(--blanc);
  color: var(--texte-carte);
  border-radius: 20px;
  padding: 20px 18px 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  color-scheme: light;
}

.champ { margin-bottom: 14px; }
.champ label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.facultatif { font-weight: 400; color: var(--texte-doux); }
.champ input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid #C5CDD7;
  border-radius: 12px;
  font: inherit;
  font-size: 16px; /* évite le zoom automatique sur iPhone */
  color: var(--marine);
  background: #FBFBFC;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.champ input:focus {
  outline: none;
  border-color: var(--marine);
  box-shadow: 0 0 0 3px rgba(200, 149, 74, 0.45);
  background: var(--blanc);
}
.champ input[aria-invalid="true"] { border-color: var(--rouge); }
.aide { margin: 6px 0 0; font-size: 0.875rem; color: var(--texte-doux); min-height: 0; }
.aide:empty { display: none; }
.aide.erreur { color: var(--rouge); }
.aide .lien { color: var(--marine); }

.case {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  margin: 10px 0;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}
.case input { width: 22px; height: 22px; margin: 0; accent-color: var(--marine); cursor: pointer; }
.case a { font-weight: 600; }

.pot-de-miel { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin-top: 16px;
  padding: 10px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--marine);
  color: var(--blanc);
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px rgba(233, 200, 145, 0.55), 0 8px 18px rgba(11, 37, 69, 0.3);
  transition: transform 0.1s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.bouton:active { transform: scale(0.98); }
.bouton:disabled { opacity: 0.75; cursor: progress; }
.bouton:focus-visible { outline: 3px solid var(--caramel); outline-offset: 3px; }
.bouton.secondaire { background: transparent; color: var(--marine); box-shadow: inset 0 0 0 1.5px #C5CDD7; font-size: 1.2rem; min-height: 48px; }

.message-erreur {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #FDECEA;
  color: #8C1D18;
  font-size: 0.92rem;
}
.mentions { margin: 14px 0 0; font-size: 0.78rem; color: var(--texte-doux); text-align: center; line-height: 1.45; }

.deja {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(233, 200, 145, 0.14);
  border: 1px solid rgba(233, 200, 145, 0.4);
  font-size: 0.92rem;
  text-align: center;
}
.lien {
  background: none;
  border: 0;
  padding: 0;
  color: var(--caramel-clair);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.termine { text-align: center; }
.termine h2 { font-family: var(--serif); font-size: 1.9rem; margin: 0 0 6px; }

.pied {
  padding: 8px 16px max(24px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}
.pied p { margin: 4px 0; }

/* ── Fenêtre de résultat ─────────────────────────────── */
.resultat {
  width: min(440px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--blanc);
  color: var(--texte-carte);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  color-scheme: light;
  overflow: auto;
}
.resultat::backdrop { background: rgba(4, 14, 28, 0.74); backdrop-filter: blur(3px); }
.resultat[open] { animation: apparait 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes apparait { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }

.res { position: relative; padding: 26px 22px 20px; text-align: center; }
.res-fermer {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--texte-doux);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.res-bandeau {
  margin: 0 0 14px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #F4EBDD;
  font-size: 0.86rem;
}
.res-bravo {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--caramel);
  font-weight: 700;
}
.res h2 {
  margin: 4px 0 14px;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 8vw, 2.3rem);
  line-height: 1.05;
  font-weight: 700;
}
.res p { margin: 10px 0; font-size: 0.95rem; }
.res .petit { font-size: 0.85rem; color: var(--texte-doux); }

.code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 12px;
  padding: 10px 10px 10px 18px;
  border: 2px dashed var(--marine);
  border-radius: 14px;
  background: #F8F3EA;
}
.code-valeur {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.12em;
  user-select: all;
  -webkit-user-select: all;
  word-break: break-all;
}
.copier {
  flex: none;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--marine);
  color: var(--blanc);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Bon cookie : animé et horodaté en direct (une capture d'écran se repère) */
.bon {
  position: relative;
  overflow: hidden;
  margin: 6px 0 12px;
  padding: 20px 18px 18px;
  border-radius: 16px;
  background: var(--marine);
  color: var(--blanc);
  isolation: isolate;
  -webkit-mask: radial-gradient(circle 11px at 0 58%, transparent 98%, #000) , radial-gradient(circle 11px at 100% 58%, transparent 98%, #000);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle 11px at 0 58%, transparent 98%, #000), radial-gradient(circle 11px at 100% 58%, transparent 98%, #000);
  mask-composite: intersect;
}
.bon::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -160px;
  right: -160px;
  z-index: -1;
  background: repeating-linear-gradient(150deg, transparent 0 40px, rgba(230, 232, 234, 0.09) 40px 80px);
  animation: defile 2.4s linear infinite;
}
@keyframes defile { to { transform: translateX(160px); } }
.bon .bon-titre { margin: 0; font-size: 0.78rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--caramel-clair); }
.bon .bon-lot { margin: 2px 0 10px; font-family: var(--serif); font-size: 2rem; font-weight: 700; line-height: 1.05; }
.bon .bon-ticket { margin: 0; font-size: 0.95rem; }
.bon .bon-ticket strong { font-size: 1.2rem; letter-spacing: 0.08em; }
.bon .bon-direct {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.bon-direct::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ADE80;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
.tampon {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 6px 18px;
  border: 4px solid #FF6B5E;
  border-radius: 10px;
  color: #FF8A80;
  background: rgba(7, 26, 51, 0.9);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-12deg);
}
.tampon span { font-size: 0.8rem; letter-spacing: 0.05em; }
.bon.remis > :not(.tampon) { opacity: 0.4; }
.bon.remis::before { animation: none; }
.bon.remis .bon-direct::before { background: #FF6B5E; animation: none; }

.equipe { margin: 14px 0 4px; }
.bouton-remise {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--caramel);
  color: var(--marine);
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}
.bouton-remise:disabled { opacity: 0.7; cursor: progress; }
.bouton-remise:focus-visible { outline: 3px solid var(--marine); outline-offset: 3px; }
.equipe-msg { margin: 8px 0 0 !important; font-size: 0.86rem !important; text-align: center; }
.equipe-msg.erreur { color: var(--rouge); }

.confettis { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 5; }

/* ── Grand écran : roue à gauche, texte et formulaire à droite ── */
@media (min-width: 900px) {
  .page {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    grid-template-areas: "scene entete" "scene jeu";
    grid-template-rows: auto 1fr;
    column-gap: 56px;
    row-gap: 22px;
    padding-top: 48px;
    align-items: start;
  }
  .entete { text-align: left; }
  .logo { margin: 0 0 18px; }
  .intro { margin-left: 0; }
  .scene { position: sticky; top: 40px; padding-top: 30px; }
  .roue-cadre { width: min(100%, 480px); }
  .carte { padding: 24px 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .faisceau, .ampoule.a, .ampoule.b, .bon::before, .bon-direct::before { animation: none; }
  .resultat[open] { animation: none; }
}
