/* ====================================================
   RESET & BASE
   ==================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Lato', sans-serif;
  background: #0a0a1a;
  color: #f0e6d3;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ====================================================
   ÉTOILES
   ==================================================== */
.stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ====================================================
   PAGE HEADER
   ==================================================== */
header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.2rem 1.2rem 1.2rem;
}

.tagline {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: #c9a84c;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 9vw, 3.6rem);
  color: #f5d78e;
  text-shadow: 0 0 40px rgba(212,168,83,.5);
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.dates {
  color: #c9a84c;
  font-size: .8rem;
  letter-spacing: .3em;
  font-weight: 300;
  margin-bottom: .9rem;
}

.instr {
  color: #a08870;
  font-size: .85rem;
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: .75rem;
}

.counter-wrap { display: flex; justify-content: center; }

.counter {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(212,168,83,.1);
  border: 1px solid rgba(212,168,83,.3);
  border-radius: 30px;
  padding: .3rem 1.1rem;
  color: #f5d78e;
  font-size: .9rem;
  font-weight: 300;
  transition: background .3s;
}

.counter.pulse { animation: cPulse .45s ease; }
@keyframes cPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.07)} }

.cstar { color: #c9a84c; font-size: .7rem; }

/* ====================================================
   LISTE DE TICKETS
   ==================================================== */
main {
  position: relative;
  z-index: 1;
  padding: .75rem 1rem 3rem;
  max-width: 500px;
  margin: 0 auto;
}

.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* ====================================================
   TICKET FDJ — structure générale
   ==================================================== */
.fdj-ticket {
  background: #faf3e4;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 6px 28px rgba(0,0,0,.55),
    0 0 0 1px rgba(0,0,0,.12);
  color: #1a0a00;
  position: relative;
  transition: box-shadow .4s;
}

/* Ticket gagnant : glow doré */
.fdj-ticket.ticket-won {
  box-shadow:
    0 6px 36px rgba(201,168,76,.55),
    0 0 0 2.5px #c9a84c;
}

/* ── HEADER ── */
.tk-header {
  background: linear-gradient(135deg, #5c0823 0%, #8c1a40 50%, #5c0823 100%);
  border-bottom: 3px solid #c9a84c;
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tk-header-left { line-height: 1.2; }

.tk-hearts {
  color: rgba(245,215,142,.45);
  font-size: .58rem;
  letter-spacing: .35em;
  margin-bottom: .18rem;
}

.tk-name {
  font-family: 'Playfair Display', serif;
  color: #f5d78e;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .07em;
}

.tk-sub {
  color: rgba(245,215,142,.55);
  font-size: .58rem;
  letter-spacing: .18em;
  margin-top: .1rem;
}

.tk-badge {
  background: rgba(245,215,142,.12);
  border: 1px solid rgba(245,215,142,.3);
  border-radius: 6px;
  padding: .15rem .5rem;
  color: #f5d78e;
  font-size: .62rem;
  letter-spacing: .1em;
  font-weight: 700;
}

/* ── CORPS ── */
.tk-body { padding: .75rem .85rem .65rem; }

/* Label de section */
.section-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .4rem;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: #6b0a2e;
  text-transform: uppercase;
}

.lbar {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(107,10,46,.35), transparent);
}

/* Rangées de cellules */
.cells-row {
  display: flex;
  gap: .45rem;
  justify-content: center;
}

/* ── CELLULE DE GRATTAGE ── */
.scratch-cell {
  position: relative;
  flex: 1;
  max-width: 96px;
  height: 62px;
  border-radius: 7px;
  background: #fff8ee;
  border: 1.5px solid #d4c09a;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.07);
}

/* Valeur cachée sous le grattage */
.cell-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Anton', 'Lato', sans-serif;
  font-size: 1.65rem;
  color: #6b0a2e;
  letter-spacing: -.01em;
}

/* Numéros "vos numéros" en bleu marine */
.scratch-cell[data-type="yours"] .cell-value { color: #0a2a6e; }

/* Surbrillance quand un numéro correspond */
.scratch-cell.matched .cell-value {
  color: #b8860b;
  text-shadow: 0 0 10px rgba(201,168,76,.55);
  animation: matchGlow 1.2s ease infinite alternate;
}

@keyframes matchGlow {
  from { text-shadow: 0 0 4px rgba(201,168,76,.4); }
  to   { text-shadow: 0 0 16px rgba(201,168,76,.9); }
}

/* Animation pop quand la cellule est révélée */
.scratch-cell.revealed .cell-value {
  animation: numPop .35s cubic-bezier(.34,1.56,.64,1);
}

@keyframes numPop {
  from { transform: scale(.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── CELLULE PHOTO ── */
.photo-cell .cell-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 5px;
}

.photo-cell .cell-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder coloré si pas de photo renseignée */
.cell-ph-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
}

/* Numéro en badge en bas à droite de la photo */
.cell-photo-num {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-family: 'Anton', sans-serif;
  font-size: .78rem;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.45;
}

/* Animation pop à la révélation d'une cellule photo */
.photo-cell.revealed .cell-photo {
  animation: photoReveal .4s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes photoReveal {
  from { transform: scale(.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Cellule photo gagnante → glow doré */
.photo-cell.matched {
  border-color: #c9a84c;
  box-shadow: 0 0 14px rgba(201, 168, 76, .7), inset 0 0 6px rgba(201, 168, 76, .15);
}

/* Canvas de grattage */
.cell-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  border-radius: 7px;
}

/* ── SÉPARATEUR PERFORÉ ── */
.tk-divider {
  display: flex;
  align-items: center;
  gap: 0;
  margin: .6rem -.85rem;
  position: relative;
  overflow: hidden;
}

.tk-divider::before,
.tk-divider::after {
  content: '';
  flex: 1;
  border-top: 1.5px dashed rgba(107,10,46,.25);
}

.tk-divider-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0a0a1a; /* même couleur que le fond page */
  border: 1px solid rgba(107,10,46,.15);
  flex-shrink: 0;
}

.tk-divider-inner {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 .35rem;
}

.tk-divider-text {
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .14em;
  color: #6b0a2e;
  opacity: .7;
  white-space: nowrap;
}

/* ── RÈGLE DU JEU ── */
.tk-rule {
  margin-top: .6rem;
  font-size: .6rem;
  color: #7a6a52;
  text-align: center;
  line-height: 1.55;
  padding: .38rem .5rem;
  border: 1px dashed rgba(107,10,46,.2);
  border-radius: 5px;
  background: rgba(107,10,46,.025);
}

.tk-rule strong { color: #5c0823; }

/* ── RÉSULTAT (affiché après grattage complet) ── */
.tk-result { margin-top: .6rem; }
.tk-result.hidden { display: none; }

.result-win {
  background: linear-gradient(135deg, rgba(201,168,76,.12), rgba(201,168,76,.04));
  border: 2px solid #c9a84c;
  border-radius: 10px;
  padding: .6rem .75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  animation: winIn .5s cubic-bezier(.34,1.56,.64,1);
}

@keyframes winIn {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}


.win-badge {
  font-size: .82rem;
  font-weight: 900;
  color: #c9a84c;
  letter-spacing: .14em;
}

.win-sub {
  font-size: .62rem;
  color: #7a5a38;
  line-height: 1.4;
  text-align: center;
}

.result-lose {
  text-align: center;
  padding: .45rem;
  color: #9a8060;
  font-size: .72rem;
  font-style: italic;
}

/* ── FOOTER ── */
.tk-footer {
  background: rgba(0,0,0,.045);
  border-top: 1px solid #ddd0b8;
  padding: .3rem .85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tk-serial {
  font-size: .55rem;
  color: #9a8060;
  letter-spacing: .04em;
  font-family: monospace;
}

.tk-barcode {
  font-size: .62rem;
  color: #2a1a0a;
  letter-spacing: .03em;
  font-family: monospace;
  line-height: 1;
}

/* ====================================================
   MODALS
   ==================================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4,4,16,.88);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  backdrop-filter: blur(5px);
}

.modal.active { display: flex; }

.modal-box {
  background: linear-gradient(145deg, #140828, #1c0c3a 60%, #110720);
  border: 1px solid rgba(212,168,83,.45);
  border-radius: 26px;
  padding: 1.8rem 1.4rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: modalIn .45s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 24px 64px rgba(0,0,0,.7), 0 0 0 1px rgba(212,168,83,.15);
}

@keyframes modalIn {
  from { transform: scale(.75) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-hearts { color: #c9a84c; font-size: .9rem; letter-spacing: .4em; margin-bottom: .6rem; opacity: .65; }

.modal-title {
  font-family: 'Playfair Display', serif;
  color: #f5d78e;
  font-size: 1.8rem;
  margin-bottom: .45rem;
  text-shadow: 0 0 20px rgba(245,215,142,.35);
}

.modal-sub { color: #a08870; font-size: .85rem; line-height: 1.65; margin-bottom: 1.4rem; }

/* Boutons lots */
.prizes { display: flex; flex-direction: column; gap: .85rem; }

.prize-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  background: rgba(201,168,76,.07);
  border: 1px solid rgba(201,168,76,.28);
  border-radius: 18px;
  padding: 1.1rem 1rem;
  cursor: pointer;
  transition: background .22s, border-color .22s, transform .18s;
  font-family: 'Lato', sans-serif;
  color: inherit;
}

.prize-btn:hover, .prize-btn:focus { background: rgba(201,168,76,.2); border-color: #c9a84c; transform: translateY(-2px); outline: none; }
.prize-btn:active { transform: scale(.97); }

.prize-big-icon { font-size: 2.6rem; line-height: 1; margin-bottom: .1rem; }

.prize-btn strong {
  font-family: 'Playfair Display', serif;
  color: #f5d78e;
  font-size: 1rem;
}

.prize-btn span { color: #8a7060; font-size: .78rem; }

/* Modal révélation */
.reveal-box { animation: revealIn .6s cubic-bezier(.34,1.56,.64,1); }

@keyframes revealIn {
  from { transform: scale(.5) rotate(-4deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

.rev-icon { font-size: 4.2rem; margin-bottom: .7rem; animation: float 3s ease-in-out infinite; }

@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.reveal-box h2 { font-size: 1.55rem; margin-bottom: .7rem; }

.reveal-box p { color: #a08870; font-size: .88rem; line-height: 1.65; margin-bottom: .35rem; }

.rev-love {
  color: #c9a84c !important;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.1rem !important;
  margin-top: 1rem !important;
  text-shadow: 0 0 12px rgba(201,168,76,.45);
}

/* ====================================================
   CONFETTIS
   ==================================================== */
.confetti-zone {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 26px;
}

.cp {
  position: absolute;
  top: -10px;
  animation: cpFall linear forwards;
}

@keyframes cpFall {
  0%   { opacity: 1; transform: translateY(-10px) rotate(0deg); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(460px) rotate(740deg); }
}
