/* ===================== Base & palette ===================== */
:root {
  --bg-deep: #0c0416;
  --bg-mid: #24092f;
  --pink: #ff6fb8;
  --pink-soft: #ffb6dd;
  --violet: #b565ff;
  --gold: #ffd76e;
  --text: #fbeaf7;
  --card-bg: rgba(30, 12, 40, 0.55);
  --card-border: rgba(255, 182, 221, 0.25);
}

* { box-sizing: border-box; }

/* L'attribut natif "hidden" doit toujours gagner, même face à des règles
   display: flex plus bas dans la feuille de style (sinon #app / #finale
   restent visibles en arrière-plan et cassent le centrage). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: radial-gradient(ellipse at 50% 20%, var(--bg-mid), var(--bg-deep) 70%);
  color: var(--text);
  cursor: default;
}

button {
  font-family: inherit;
  border: none;
  outline: none;
  cursor: pointer;
}

/* ===================== Mur de photos (pellicule) ===================== */
#photo-wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  gap: 8px;
  padding: 0 8px;
  overflow: hidden;
  background: var(--bg-deep);
}

#photo-wall::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 3, 18, 0.78), rgba(18, 5, 28, 0.6) 35%, rgba(10, 3, 18, 0.85));
  pointer-events: none;
}

.reel-col {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #070210;
  padding: 0 7px;
}

.reel-col::before,
.reel-col::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7px;
  background-image: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0 7px, transparent 7px 18px);
  background-position: center top;
  opacity: 0.45;
  z-index: 1;
}

.reel-col::before { left: 0; }
.reel-col::after { right: 0; }

.reel-track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  will-change: transform;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes reelScrollUp {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

@keyframes reelScrollDown {
  from { transform: translateY(-50%); }
  to { transform: translateY(0); }
}

.reel-cell {
  position: relative;
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 111, 184, 0.22), rgba(181, 101, 255, 0.22));
  border: 2px solid rgba(255, 255, 255, 0.08);
}

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

.reel-cell--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-placeholder {
  font-size: 2.4rem;
  opacity: 0.85;
  filter: drop-shadow(0 0 10px rgba(255, 111, 184, 0.45));
}

/* ===================== Vogue masthead ===================== */
#vogue-mark {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 7vh;
  pointer-events: none;
  text-align: center;
  transition: padding-top 0.45s ease;
}

body.scene-finale #vogue-mark {
  inset: auto;
  top: 0;
  left: 0;
  right: 0;
  height: auto;
  padding-top: 3.2vh;
}

.vogue-word {
  margin: 0;
  font-family: "Playfair Display", Didot, "Bodoni MT", "Times New Roman", serif;
  font-weight: 900;
  font-size: clamp(4.8rem, 18vw, 13rem);
  letter-spacing: 0.12em;
  line-height: 0.82;
  color: #fff8f2;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35),
    0 12px 40px rgba(0, 0, 0, 0.55);
}

body.scene-finale .vogue-word {
  font-size: clamp(3.4rem, 13vw, 8.2rem);
}

.vogue-line {
  margin: 14px 0 0;
  font-family: "Cormorant Garamond", Didot, "Times New Roman", serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1rem, 2.6vw, 1.85rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(255, 246, 238, 0.88);
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

body.scene-finale .vogue-line {
  margin-top: 8px;
  letter-spacing: 0.28em;
  font-size: clamp(0.85rem, 2vw, 1.3rem);
}

.vogue-line::before,
.vogue-line::after {
  content: '';
  display: inline-block;
  width: 42px;
  height: 1px;
  margin: 0 16px;
  vertical-align: middle;
  background: rgba(255, 246, 238, 0.55);
}

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

#floaters {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.floater {
  position: absolute;
  bottom: -60px;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 6px rgba(255, 111, 184, 0.55));
  animation-name: floatUp;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

@keyframes floatUp {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.8; }
  100% { transform: translate(var(--drift, 40px), -110vh) rotate(360deg); opacity: 0; }
}

/* Sparkles that trail the cursor */
.sparkle {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  color: var(--gold);
  font-size: 14px;
  will-change: transform, opacity;
  animation: sparkleFade 700ms ease-out forwards;
  text-shadow: 0 0 6px var(--gold), 0 0 12px var(--pink);
}

@keyframes sparkleFade {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(0deg); opacity: 1; }
  60% { transform: translate(-50%, -50%) scale(1.15) rotate(90deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.2) rotate(180deg); opacity: 0; }
}

/* ===================== Shared elements ===================== */
.btn {
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: #fff;
  box-shadow: 0 6px 24px rgba(255, 111, 184, 0.45);
}

.btn-primary:hover {
  box-shadow: 0 8px 30px rgba(255, 111, 184, 0.7);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--pink-soft);
  border: 1px solid var(--card-border);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }

.lang-switch {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 40;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(20, 8, 28, 0.55);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
}

.lang-switch button {
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--pink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.lang-switch button.is-active {
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: #fff;
}

/* ===================== Cover screen ===================== */
#cover {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding-bottom: 14vh;
  text-align: center;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

#cover.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-glow {
  position: absolute;
  width: 48vmax;
  height: 48vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 111, 184, 0.18), transparent 70%);
  filter: blur(20px);
  animation: pulseGlow 4s ease-in-out infinite;
  z-index: -1;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
}

.cover-eyebrow {
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--pink-soft);
  opacity: 0.85;
}

.cover-title {
  display: none;
}

.cover-heart {
  display: inline-block;
  margin-left: 0.15em;
  animation: heartBeat 1.4s ease-in-out infinite;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

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

/* ===================== Main app ===================== */
#app {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ===================== Card / slides ===================== */
.card {
  position: relative;
  width: min(620px, 92vw);
  min-height: 480px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(255, 111, 184, 0.12) inset;
  padding: 44px 40px 32px;
  display: flex;
  flex-direction: column;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.card.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
}

.dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 30px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}

.dot.active {
  background: linear-gradient(135deg, var(--pink), var(--gold));
  transform: scale(1.3);
}

.slide-viewport {
  position: relative;
  flex: 1;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.slide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.6s cubic-bezier(.22,1,.36,1), transform 0.6s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
  padding: 8px 16px;
}

.slide-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(255, 111, 184, 0.28), rgba(181, 101, 255, 0.28));
  border: 1px solid var(--card-border);
  box-shadow: 0 0 28px rgba(255, 111, 184, 0.4), inset 0 0 12px rgba(255, 255, 255, 0.1);
  animation: iconPulse 2.4s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.slide.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.slide.leaving {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
}

.slide-line {
  margin: 0;
  font-size: clamp(1.25rem, 4.8vw, 1.9rem);
  line-height: 1.45;
  font-weight: 600;
  color: var(--text);
}

.slide-line.big {
  font-size: clamp(1.9rem, 6.4vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink-soft), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  gap: 12px;
}

.card-actions .btn { flex: none; padding: 12px 22px; font-size: 0.92rem; }

/* ===================== Finale scene ===================== */
.finale {
  position: relative;
  z-index: 10;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  text-align: center;
  padding: var(--finale-top, 160px) 20px 20px;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.finale.visible { opacity: 1; }

.finale-title {
  font-size: clamp(1.7rem, 5.4vw, 2.8rem);
  margin: 0;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 111, 184, 0.5);
}

.finale-name {
  background: linear-gradient(135deg, var(--pink), var(--gold), var(--violet));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 4s ease infinite, glowPulse 2.4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 111, 184, 0.5)); }
  50% { filter: drop-shadow(0 0 26px rgba(255, 111, 184, 0.9)); }
}

.cake-hint {
  font-size: 0.85rem;
  color: var(--pink-soft);
  opacity: 0.6;
  margin: 2px 0 0;
  max-width: 360px;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.finale-sub {
  font-size: 1.05rem;
  color: var(--pink-soft);
  max-width: 420px;
  opacity: 0.9;
  line-height: 1.45;
  padding: 0 12px;
}

/* --- Cake --- */
.cake-wrap {
  position: relative;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.candles {
  display: flex;
  gap: 26px;
  align-items: flex-end;
  margin-bottom: -4px;
  z-index: 2;
}

.candle {
  width: 8px;
  height: 34px;
  background: linear-gradient(180deg, #fff6d8, var(--gold));
  border-radius: 3px;
  position: relative;
}

.candle-tall { height: 44px; }

.flame {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 18px;
  background: radial-gradient(circle at 50% 70%, #fff7cf, var(--gold) 55%, #ff8a3d 90%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  filter: drop-shadow(0 0 8px rgba(255, 184, 77, 0.9));
  animation: flicker 0.4s ease-in-out infinite alternate;
}

@keyframes flicker {
  0% { transform: translateX(-50%) scale(1) rotate(-3deg); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.08) rotate(2deg); opacity: 0.9; }
  100% { transform: translateX(-52%) scale(0.96) rotate(-2deg); opacity: 1; }
}

.flame.out {
  animation: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cake { position: relative; z-index: 1; width: 100%; }

.layer {
  width: 100%;
  border-radius: 14px 14px 6px 6px;
  position: relative;
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.15), 0 6px 14px rgba(0, 0, 0, 0.35);
}

.layer-top {
  height: 34px;
  width: 70%;
  margin: 0 auto;
  background: linear-gradient(180deg, #ffe1f0, var(--pink));
}

.layer-mid {
  height: 44px;
  width: 88%;
  margin: -6px auto 0;
  background: linear-gradient(180deg, #ffd2ea, #ff8fc4);
}

.layer-bottom {
  height: 54px;
  width: 100%;
  margin-top: -6px;
  background: linear-gradient(180deg, #ffc2e2, var(--violet));
}

.drip {
  position: absolute;
  inset: -6px 6px auto 6px;
  height: 14px;
  background: repeating-linear-gradient(90deg, #fff 0 10px, transparent 10px 20px);
  border-radius: 0 0 50% 50%;
  opacity: 0.85;
}

.dots-icing {
  position: absolute;
  inset: 6px 10px auto 10px;
  height: 8px;
  display: flex;
  justify-content: space-around;
}

.dots-icing::before, .dots-icing::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.8;
}

.plate {
  width: 260px;
  height: 16px;
  margin-top: -4px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.25), rgba(255,255,255,0.03) 70%);
  box-shadow: 0 0 30px rgba(255, 111, 184, 0.25);
}

/* ===================== Responsive ===================== */
@media (max-width: 480px) {
  .card { padding: 32px 22px 22px; min-height: 420px; }
  .slide-viewport { min-height: 220px; }
  .slide-icon { width: 60px; height: 60px; font-size: 1.8rem; }
  .cake-wrap { width: 200px; }
}

@media (max-height: 700px) {
  .card { min-height: 380px; }
  .slide-viewport { min-height: 200px; }
  .slide-icon { width: 56px; height: 56px; font-size: 1.7rem; margin-bottom: 0; }
  .slide { gap: 12px; }
  .finale { gap: 6px; }
  .finale-title { font-size: clamp(1.35rem, 4vw, 1.8rem); }
  .finale-sub { font-size: 0.92rem; }
  body.scene-finale #vogue-mark { padding-top: 1.6vh; }
  body.scene-finale .vogue-word { font-size: clamp(2.6rem, 11vw, 4.6rem); }
}
