/* ==========================================================================
   Ticket Mystère — Carte à Gratter (Mobile-First & Finition Brillante)
   ========================================================================== */

:root {
  --bg-deep: #0b0511;
  --bg-plum: #1b0b26;
  --bg-wine: #2d0f2b;

  --gold-100: #fff7dc;
  --gold-200: #fae3a2;
  --gold-300: #ecc168;
  --gold-400: #d49b38;
  --gold-500: #9f6a16;

  --rose-gold: #f6b3c6;
  --ivory: #fffaf2;
  --ivory-soft: #f5ead8;
  --ink: #24101d;
  --ink-muted: #6c4d5e;
  --burgundy: #7a1438;
  --burgundy-dark: #4f0922;

  --rx: 0deg;
  --ry: 0deg;
  --glare-x: 50%;
  --glare-y: 35%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg-deep);
}

body {
  min-height: 100dvh;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ivory);
  background:
    radial-gradient(120% 80% at 50% 0%, #32123b 0%, var(--bg-plum) 42%, var(--bg-deep) 100%);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  padding: max(16px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Empêche tout flash du contenu caché avant que le canvas doré soit peint */
body:not(.foil-ready) .clue-under,
body:not(.foil-ready) .prize-under {
  opacity: 0;
}

/* ---------- Fond d'ambiance théâtre & bokeh ---------- */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.spotlight {
  position: absolute;
  top: -25%;
  width: 75vw;
  height: 90vh;
  filter: blur(55px);
  opacity: 0.34;
  transform-origin: top center;
  animation: swaySpotlight 11s ease-in-out infinite alternate;
}

.spotlight-left {
  left: -18%;
  background: radial-gradient(ellipse at top, rgba(247, 200, 107, 0.45), transparent 70%);
}

.spotlight-right {
  right: -18%;
  background: radial-gradient(ellipse at top, rgba(235, 114, 165, 0.36), transparent 70%);
  animation-delay: -5.5s;
}

@keyframes swaySpotlight {
  0% { transform: rotate(-6deg) scale(1); }
  100% { transform: rotate(6deg) scale(1.06); }
}

.bokeh-layer {
  position: absolute;
  inset: 0;
}

.bokeh-dot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 232, 168, 0.85) 0%, rgba(255, 210, 115, 0) 72%);
  animation: floatBokeh linear infinite;
  opacity: 0;
}

@keyframes floatBokeh {
  0% {
    transform: translateY(20px) scale(0.7);
    opacity: 0;
  }
  20% {
    opacity: var(--max-op, 0.45);
  }
  80% {
    opacity: var(--max-op, 0.45);
  }
  100% {
    transform: translateY(-90px) scale(1.15);
    opacity: 0;
  }
}

/* ---------- Canvas plein écran pour paillettes & confettis ---------- */
.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ---------- Bouton son ---------- */
.sound-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(250, 227, 162, 0.28);
  background: rgba(23, 10, 33, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold-100);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.sound-toggle:hover {
  border-color: rgba(250, 227, 162, 0.6);
  background: rgba(38, 16, 54, 0.85);
}

.sound-toggle:active {
  transform: scale(0.95);
}

.sound-toggle.is-muted {
  opacity: 0.65;
}

/* ---------- Scène principale ---------- */
.stage {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 26px;
}

.hero-header {
  text-align: center;
  margin-bottom: 18px;
}

.serial-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(236, 193, 104, 0.16), rgba(246, 179, 198, 0.12));
  border: 1px solid rgba(250, 227, 162, 0.36);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-200);
  margin-bottom: 10px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffd97d;
  box-shadow: 0 0 10px #ffd97d;
  animation: pulseDot 1.8s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

.hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 6.4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #fffaf0 0%, var(--gold-200) 48%, var(--rose-gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 30px rgba(236, 193, 104, 0.15);
}

.hero-title em {
  font-style: italic;
  font-weight: 600;
}

.hero-subtitle {
  margin-top: 7px;
  font-size: 13.5px;
  color: rgba(255, 247, 220, 0.78);
  line-height: 1.4;
}

/* ---------- Perspective 3D & Ticket ---------- */
.card-perspective {
  width: 100%;
  perspective: 1100px;
}

.scratch-ticket {
  position: relative;
  width: 100%;
  border-radius: 24px;
  padding: 3px;
  background: linear-gradient(
    135deg,
    #fff3c4 0%,
    #d49b38 22%,
    #f6b3c6 46%,
    #fae3a2 70%,
    #b77b1d 100%
  );
  background-size: 220% 220%;
  animation: borderShimmer 7s ease infinite;
  box-shadow:
    0 24px 55px rgba(0, 0, 0, 0.65),
    0 0 38px rgba(236, 193, 104, 0.18);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.18s ease-out, box-shadow 0.4s ease;
  will-change: transform;
}

.scratch-ticket.is-revealed {
  box-shadow:
    0 28px 65px rgba(0, 0, 0, 0.72),
    0 0 55px rgba(250, 214, 122, 0.34);
}

@keyframes borderShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.ticket-holo-glare {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  pointer-events: none;
  z-index: 25;
  mix-blend-mode: screen;
  opacity: 0.42;
  background: radial-gradient(
    circle 210px at var(--glare-x) var(--glare-y),
    rgba(255, 250, 232, 0.55) 0%,
    rgba(246, 179, 198, 0.22) 38%,
    rgba(130, 224, 255, 0.14) 62%,
    transparent 82%
  );
  transition: opacity 0.3s ease;
}

.ticket-inner-frame {
  position: relative;
  border-radius: 21px;
  background:
    radial-gradient(circle at 50% 0%, #39163f 0%, #230d2b 48%, #180820 100%);
  padding: 16px 15px 18px;
  overflow: hidden;
}

/* Texture guillochée discrète */
.ticket-inner-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(250, 227, 162, 0.5) 0px,
      rgba(250, 227, 162, 0.5) 1px,
      transparent 1px,
      transparent 12px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(250, 227, 162, 0.4) 0px,
      rgba(250, 227, 162, 0.4) 1px,
      transparent 1px,
      transparent 12px
    );
}

/* En-tête du ticket */
.ticket-top-band {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(250, 227, 162, 0.22);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  color: var(--gold-200);
}

.brand-star {
  color: var(--rose-gold);
  font-size: 12px;
}

.ticket-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-200), var(--gold-400));
  color: #271303;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 3px 12px rgba(236, 193, 104, 0.35);
}

/* ---------- Sections de jeu ---------- */
.game-section {
  position: relative;
  z-index: 2;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}

.game-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(250, 227, 162, 0.14);
  border: 1px solid rgba(250, 227, 162, 0.38);
  color: var(--gold-200);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.game-desc {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 247, 220, 0.85);
}

/* ---------- JEU 1 : 3 jetons indices ---------- */
.clues-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  justify-items: center;
}

.clue-slot {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fffef9 0%, #f6e7c8 70%, #ebd2a2 100%);
  box-shadow:
    inset 0 2px 8px rgba(122, 20, 56, 0.18),
    0 6px 16px rgba(0, 0, 0, 0.38),
    0 0 0 2px rgba(250, 227, 162, 0.55);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.clue-slot.is-revealed {
  transform: scale(1.04);
  box-shadow:
    inset 0 2px 8px rgba(122, 20, 56, 0.12),
    0 8px 22px rgba(250, 227, 162, 0.32),
    0 0 0 2.5px var(--gold-200);
}

.clue-under {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  color: var(--ink);
  user-select: none;
  padding: 6px;
}

.clue-emoji {
  font-size: 26px;
  line-height: 1.1;
}

.clue-text {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--burgundy-dark);
}


/* ---------- Séparateur perforé ---------- */
.ticket-perforation {
  position: relative;
  display: flex;
  align-items: center;
  margin: 16px -15px 14px;
  height: 22px;
}

.perf-line {
  flex: 1;
  border-top: 2px dashed rgba(250, 227, 162, 0.3);
  margin: 0 14px;
}

.notch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #14081d;
  box-shadow: inset 0 0 0 2px rgba(236, 193, 104, 0.45);
}

.notch-left {
  margin-left: -10px;
}

.notch-right {
  margin-right: -10px;
}

/* ---------- JEU 2 : Zone Grand Prix ---------- */
.prize-box {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(165deg, var(--ivory) 0%, var(--ivory-soft) 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(212, 155, 56, 0.45),
    0 10px 26px rgba(0, 0, 0, 0.42);
}

.prize-under {
  position: relative;
  color: var(--ink);
  transition: opacity 0.25s ease;
}

.show-banner {
  position: relative;
  width: 100%;
  height: 146px;
  background: linear-gradient(135deg, #4b1031, #1f0a2c);
  overflow: hidden;
}

.show-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}

.show-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(20, 6, 26, 0.12) 0%,
    rgba(20, 6, 26, 0.15) 55%,
    rgba(255, 250, 242, 0.96) 100%
  );
}

.show-category-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20, 8, 28, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(250, 227, 162, 0.45);
  color: var(--gold-100);
  font-size: 11px;
  font-weight: 700;
}

.show-details {
  padding: 6px 14px 15px;
  text-align: center;
}

.invite-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--burgundy);
  margin-bottom: 3px;
}

.show-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  color: #1f0a17;
}

.show-company {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 14px;
  font-weight: 600;
  color: var(--burgundy);
  margin-top: 2px;
}

.show-meta {
  margin: 12px 0 10px;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(122, 20, 56, 0.06);
  border: 1px solid rgba(122, 20, 56, 0.13);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.meta-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12px;
  line-height: 1.35;
}

.meta-icon {
  font-size: 15px;
  line-height: 1.2;
  flex-shrink: 0;
}

.meta-item strong {
  display: block;
  color: #240d1a;
  font-weight: 700;
}

.meta-item span {
  display: block;
  color: var(--ink-muted);
  font-size: 11px;
}

.show-pitch {
  font-size: 12px;
  line-height: 1.48;
  color: #4f3142;
  font-style: italic;
  margin-bottom: 13px;
  padding: 0 2px;
}

.prize-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-accept {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #8b1640 0%, #5e0b2a 100%);
  color: #fffaf2;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(122, 20, 56, 0.34),
    inset 0 1px 0 rgba(255, 224, 178, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.25s ease;
}

.btn-accept:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(122, 20, 56, 0.44);
}

.btn-accept:active {
  transform: scale(0.98);
}

.btn-accept.is-accepted {
  background: linear-gradient(135deg, #1b7f52 0%, #115c3a 100%);
  box-shadow: 0 8px 22px rgba(27, 127, 82, 0.35);
}

.btn-details {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(122, 20, 56, 0.24);
  background: rgba(255, 255, 255, 0.65);
  color: var(--burgundy-dark);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-details:hover {
  background: #ffffff;
  border-color: rgba(122, 20, 56, 0.48);
}

/* ---------- Canvas à gratter & reflets métalliques ---------- */
.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: crosshair;
  z-index: 4;
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.scratch-canvas.is-done {
  opacity: 0;
  pointer-events: none;
}

/* Reflet brillant animé sur le film doré */
.foil-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  border-radius: inherit;
  transition: opacity 0.5s ease;
}

.foil-sheen::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -90%;
  width: 75%;
  height: 180%;
  transform: rotate(24deg);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 249, 224, 0.16) 28%,
    rgba(255, 255, 255, 0.58) 50%,
    rgba(246, 179, 210, 0.26) 65%,
    rgba(160, 232, 255, 0.16) 78%,
    rgba(255, 255, 255, 0) 100%
  );
  mix-blend-mode: screen;
  animation: sweepGlint 3.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.clue-slot .foil-sheen::before {
  animation-duration: 3.1s;
}

.clue-slot:nth-child(2) .foil-sheen::before {
  animation-delay: 0.45s;
}

.clue-slot:nth-child(3) .foil-sheen::before {
  animation-delay: 0.9s;
}

.foil-sheen.is-done {
  opacity: 0;
}

@keyframes sweepGlint {
  0% {
    left: -110%;
  }
  55%, 100% {
    left: 150%;
  }
}

/* ---------- Barre de progression ---------- */
.progress-row {
  margin-top: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.35s ease;
}

.progress-row.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 247, 220, 0.12);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-100), var(--rose-gold));
  box-shadow: 0 0 10px rgba(250, 227, 162, 0.6);
  transition: width 0.15s ease-out;
}

.progress-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-200);
  min-width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Pied de scène ---------- */
.stage-footer {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
}

.btn-ghost {
  border: 1px solid rgba(250, 227, 162, 0.28);
  background: rgba(255, 247, 220, 0.06);
  color: var(--gold-100);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(250, 227, 162, 0.14);
  border-color: rgba(250, 227, 162, 0.55);
}

.btn-ghost:active {
  transform: scale(0.96);
}

/* ---------- Petits écrans (iPhone SE / 360px) ---------- */
@media (max-width: 380px) {
  .clue-slot {
    width: 78px;
    height: 78px;
  }
  .clue-emoji {
    font-size: 22px;
  }
  .clue-text {
    font-size: 10px;
  }
  .show-banner {
    height: 128px;
  }
  .show-title {
    font-size: 1.4rem;
  }
}

/* ---------- Respect préférence réduction mouvement ---------- */
@media (prefers-reduced-motion: reduce) {
  .spotlight,
  .bokeh-dot,
  .scratch-ticket,
  .foil-sheen::before {
    animation: none !important;
  }
}
