:root {
  --bg: #ffffff;
  --bg-2: #f5f7fa;
  --panel: #ffffff;
  --line: #e4e7ec;
  --ink: #21262e;
  --ink-2: #505965;
  --muted: #7c8591;
  --pink: #fd267a;
  --orange: #ff6036;
  --brand: #fe3c72;
  --grad: linear-gradient(45deg, var(--pink), var(--orange));
  --like: #1fd18a;
  --like-grad: linear-gradient(45deg, #1fd18a, #46e8b0);
  --nope: #ff4458;
  --nope-grad: linear-gradient(45deg, #fd267a, #ff6036);
  --super: #1e9bff;
  --rewind: #f7b13a;
  --boost: #a64dff;
  --radius: 12px;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --shadow-btn: 0 4px 14px rgba(33, 38, 46, .12), 0 1px 3px rgba(33, 38, 46, .08);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  overscroll-behavior: none;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* ---------- Accueil ---------- */
#welcome { overflow-y: auto; background: var(--grad); color: #fff; }
.welcome-bg {
  position: absolute;
  inset: 0;
  background: var(--welcome-img, none) center 20% / cover no-repeat;
  opacity: .14;
  mix-blend-mode: luminosity;
}
.welcome-inner {
  position: relative;
  margin: auto;
  width: 100%;
  max-width: 420px;
  padding: 40px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.brand { text-align: center; animation: rise .9s var(--ease-out) both; }
.logo { width: 56px; height: 56px; color: var(--brand); }
#welcome .logo { width: 64px; height: 64px; color: #fff; }
.logo.small { width: 30px; height: 30px; }
h1 {
  font: 800 clamp(44px, 13vw, 58px)/1 var(--sans);
  margin: 12px 0 12px;
  letter-spacing: -.035em;
}
.tagline { margin: 0; color: rgba(255, 255, 255, .92); font: 600 17px/1.4 var(--sans); }

#signup { display: flex; flex-direction: column; gap: 14px; animation: rise .9s .12s var(--ease-out) both; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .9); font-weight: 700; }
.field input {
  appearance: none;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  font: 600 17px var(--sans);
  padding: 14px 20px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #b3b9c2; }
.field input:focus { box-shadow: 0 0 0 4px rgba(255, 255, 255, .45); }
.field input[aria-invalid="true"] { border-color: #8a0f2d; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: rgba(255, 255, 255, .92); line-height: 1.45; cursor: pointer; font-weight: 500; }
.consent input { accent-color: #fff; width: 20px; height: 20px; margin: 1px 0 0; flex: none; }
.form-error { margin: 0; color: #fff; font-size: 14px; font-weight: 700; background: rgba(138, 15, 45, .35); padding: 8px 14px; border-radius: 10px; }

.btn-primary {
  border: 0;
  border-radius: 999px;
  padding: 16px 24px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 20px -8px rgba(253, 38, 122, .6);
  transition: transform .15s, filter .2s;
}
#welcome .btn-primary { background: #fff; color: var(--brand); box-shadow: 0 10px 24px -10px rgba(120, 10, 40, .5); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { filter: grayscale(.6) brightness(.9); opacity: .7; }
.btn-ghost {
  display: inline-block;
  padding: 12px 20px;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
}

/* ---------- Deck ---------- */
#deck { background: var(--bg); }
.deck-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 8px;
  color: var(--brand);
}
.deck-title { font: 800 26px/1 var(--sans); letter-spacing: -.04em; }
.counter {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-2);
  padding: 4px 10px;
  border-radius: 999px;
}

.stack {
  position: relative;
  flex: 1;
  margin: 4px 10px 0;
  min-height: 0;
}

.card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #111;
  box-shadow: 0 6px 24px -6px rgba(33, 38, 46, .3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  transform-origin: 50% 100%;
  cursor: grab;
  color: #fff;
}
.card:active { cursor: grabbing; }
.card.behind { transform: scale(.95) translateY(10px); transition: transform .35s var(--ease-out); pointer-events: none; }
.card.behind-2 { transform: scale(.9) translateY(20px); pointer-events: none; }
.card.entering { animation: card-in .5s var(--ease-out) both; }

.photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}
.bars {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.bars i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
  transition: background .2s;
}
.bars i.on { background: #fff; box-shadow: none; }

.card-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 100px 18px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .55) 50%, transparent 100%);
  z-index: 2;
}
.card-brand { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .85); }
.card-name { font: 800 30px/1.05 var(--sans); letter-spacing: -.02em; margin: 4px 0 10px; text-wrap: balance; padding-right: 44px; text-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card-price { font-weight: 800; font-size: 18px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  color: #fff;
  backdrop-filter: blur(6px);
}
.card-more {
  position: absolute;
  right: 16px;
  bottom: 22px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  display: grid;
  place-items: center;
  font: 800 17px var(--sans);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.stamp {
  position: absolute;
  top: 48px;
  z-index: 4;
  padding: 4px 12px;
  border: 5px solid currentColor;
  border-radius: 8px;
  font: 800 38px/1 var(--sans);
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  text-transform: uppercase;
}
.stamp-like { left: 24px; color: var(--like); transform: rotate(-18deg); }
.stamp-nope { right: 24px; color: var(--nope); transform: rotate(18deg); }
.stamp-super {
  left: 50%;
  top: auto;
  bottom: 34%;
  color: var(--super);
  transform: translateX(-50%) rotate(-10deg);
  font-size: 30px;
  white-space: nowrap;
  text-align: center;
}

/* contrôles */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px 12px 18px;
}
.ctl {
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: #fff;
  box-shadow: var(--shadow-btn);
  transition: transform .18s var(--spring), background .2s, color .2s;
}
.ctl:active { transform: scale(.85); }
.ctl:disabled { opacity: .35; pointer-events: none; }
.ctl svg { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ctl-undo, .ctl-info { width: 48px; height: 48px; }
.ctl-undo { color: var(--rewind); }
.ctl-info { color: var(--boost); }
.ctl-undo svg, .ctl-info svg { width: 22px; height: 22px; stroke-width: 2.8; }
.ctl-nope, .ctl-like { width: 64px; height: 64px; }
.ctl-nope svg { width: 30px; height: 30px; stroke-width: 3.4; }
.ctl-like svg { width: 32px; height: 32px; }
.ctl-nope { color: var(--nope); }
.ctl-like { color: var(--like); }
.ctl-like svg { fill: currentColor; stroke: none; }
.ctl-super { width: 50px; height: 50px; color: var(--super); }
.ctl-super svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.ctl-nope.hot { background: var(--nope-grad); color: #fff; }
.ctl-like.hot { background: var(--like-grad); color: #fff; }
.ctl-super.hot { background: var(--super); color: #fff; }

/* coach marks */
.coach {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(15, 18, 24, .82);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  color: #fff;
  font: 800 22px/1.2 var(--sans);
  animation: fade .4s both;
}
.coach-row { display: flex; align-items: center; gap: 14px; width: 250px; }
.coach-row:nth-child(1) .coach-arrow { background: var(--nope-grad); }
.coach-row:nth-child(2) .coach-arrow { background: var(--like-grad); }
.coach-row:nth-child(3) .coach-arrow { background: var(--super); }
.coach-row.small { font: 600 14px/1.4 var(--sans); color: rgba(255, 255, 255, .8); max-width: 240px; text-align: center; margin-top: 12px; }
.coach-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  font: 800 22px var(--sans);
}

/* ---------- Fiche détail ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 18, 24, .5); z-index: 30; animation: fade .25s both; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88dvh;
  z-index: 31;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  transform: translateY(105%);
  transition: transform .45s var(--ease-out);
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 -10px 40px rgba(15, 18, 24, .2);
}
.sheet.open { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 4px; flex: none; }
.sheet-body { overflow-y: auto; padding: 8px 22px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.sheet-gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 6px -22px 18px; padding: 0 22px; scrollbar-width: none; }
.sheet-gallery::-webkit-scrollbar { display: none; }
.sheet-gallery img { flex: none; width: 82%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; scroll-snap-align: center; }
.sheet .card-brand { color: var(--muted); }
.sheet h3 { font: 800 28px/1.1 var(--sans); letter-spacing: -.02em; margin: 4px 0 6px; text-wrap: balance; }
.sheet .price { font-size: 20px; font-weight: 800; margin: 0 0 16px; color: var(--brand); }
.sheet .story p { color: var(--ink-2); margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 20px 0; padding: 18px; border-radius: 12px; background: var(--bg-2); }
.specs dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.specs dd { margin: 0; font-size: 14px; font-weight: 500; }
.sheet-actions { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 12px 0 6px; }
.sheet-link { display: block; text-align: center; color: var(--brand); font-weight: 700; font-size: 14px; padding: 10px; }

/* ---------- Match ---------- */
.match {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: linear-gradient(to bottom, rgba(15, 18, 24, .72), rgba(15, 18, 24, .94));
  backdrop-filter: blur(12px);
  animation: fade .35s both;
  overflow: hidden;
  padding: 24px;
  color: #fff;
}
.match-inner { position: relative; z-index: 2; text-align: center; display: flex; flex-direction: column; align-items: center; max-width: 380px; width: 100%; }
.match-kicker { margin: 0; font: italic 800 26px/1 var(--sans); letter-spacing: -.02em; color: #fff; text-transform: uppercase; animation: rise .6s .1s var(--ease-out) both; }
.match-title {
  margin: 0 0 30px;
  padding: 0 .1em;
  font: italic 800 clamp(64px, 21vw, 92px)/.95 var(--sans);
  letter-spacing: -.04em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ff7854, #fd267a 60%, #ff6036);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 20px rgba(253, 38, 122, .45));
  animation: title-pop .8s .15s var(--ease-out) both;
}
.match-duo { display: flex; align-items: center; justify-content: center; margin-bottom: 26px; }
.duo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid #fff;
  overflow: hidden;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .7);
}
.duo-user {
  display: grid;
  place-items: center;
  background: var(--grad);
  font: 800 54px/1 var(--sans);
  color: #fff;
  animation: duo-left .7s .3s var(--ease-out) both;
}
.duo-watch { animation: duo-right .7s .3s var(--ease-out) both; }
.duo-watch img { width: 100%; height: 100%; object-fit: cover; }
.duo-heart {
  width: 52px;
  height: 52px;
  margin: 0 -18px;
  z-index: 2;
  border-radius: 50%;
  background: var(--grad);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 4px #fff;
  animation: heart-beat 1.2s .8s ease-in-out infinite, pop .5s .6s var(--ease-out) both;
}
.duo-heart svg { width: 26px; height: 26px; fill: #fff; }
.match-text { color: rgba(255, 255, 255, .85); margin: 0 0 26px; font-size: 16px; line-height: 1.5; font-weight: 500; animation: rise .6s .5s var(--ease-out) both; }
.match-text b { color: #fff; font-weight: 800; }
.match .btn-primary { width: 100%; animation: rise .6s .6s var(--ease-out) both; }
.match .btn-ghost { color: rgba(255, 255, 255, .8); animation: rise .6s .7s var(--ease-out) both; }
.match-confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

/* burst (like simple) */
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 35; display: grid; place-items: center; }
.burst-heart { width: 120px; height: 120px; fill: var(--like); filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .35)); animation: burst-heart .8s var(--ease-out) forwards; }
.burst-dot { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; animation: burst-dot .7s var(--ease-out) forwards; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  opacity: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  z-index: 50;
  transition: opacity .25s, transform .3s var(--ease-out);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(15, 18, 24, .5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Fin ---------- */
#end, #again { overflow-y: auto; background: var(--bg); }
.end-inner { width: 100%; max-width: 560px; margin: 0 auto; padding: 40px 20px 40px; }
.end-inner h2 { font: 800 clamp(34px, 10vw, 46px)/1.05 var(--sans); letter-spacing: -.035em; margin: 14px 0 10px; animation: rise .7s var(--ease-out) both; }
.end-inner .lead { color: var(--ink-2); font-size: 16px; font-weight: 500; margin: 0 0 28px; animation: rise .7s .08s var(--ease-out) both; }
.end-head { text-align: center; }
.matches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  text-decoration: none;
  color: #fff;
  aspect-ratio: 3 / 4;
  animation: rise .6s var(--ease-out) both;
  box-shadow: 0 6px 18px -6px rgba(33, 38, 46, .3);
}
.match-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.match-card .mc-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 44px 12px 12px; background: linear-gradient(to top, rgba(0, 0, 0, .85), transparent); }
.match-card .mc-name { font: 800 15px/1.15 var(--sans); }
.match-card .mc-price { font-size: 13px; font-weight: 700; margin-top: 4px; opacity: .9; }
.match-card .mc-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--super);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}
.end-note {
  margin: 28px 0 20px;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
}
.end-note b { color: var(--ink); }
.end-actions { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.end-empty { text-align: center; color: var(--muted); padding: 30px 0; font: 600 18px var(--sans); }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes card-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes title-pop { 0% { opacity: 0; transform: scale(.4) rotate(-8deg); } 100% { opacity: 1; transform: none; } }
@keyframes duo-left { from { opacity: 0; transform: translateX(-120px) rotate(-30deg); } to { opacity: 1; transform: none; } }
@keyframes duo-right { from { opacity: 0; transform: translateX(120px) rotate(30deg); } to { opacity: 1; transform: none; } }
@keyframes heart-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }
@keyframes confetti-fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); } }
@keyframes burst-heart { 0% { opacity: 0; transform: scale(.2); } 35% { opacity: 1; transform: scale(1.15); } 60% { transform: scale(1); } 100% { opacity: 0; transform: scale(1.3) translateY(-30px); } }
@keyframes burst-dot { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(.3); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (min-width: 600px) {
  .stack, .controls { width: 100%; max-width: 440px; margin-left: auto; margin-right: auto; }
  .deck-header { width: 100%; max-width: 464px; margin: 0 auto; }
}
