/* ═══════════ Le Départageur — design system v1.1 ═══════════
   Réplique fidèle des 4 artboards de Tsyr (tsyr-html/*.dc.html).
   Lilita One (display) + Patrick Hand (corps) + Press Start 2P (pixel).
   Style « sticker » : contours blancs mascottes, double ombre dure #2B1B3D. */

:root {
  --bg: #1A1033;
  --ink: #2B1B3D;
  --white: #FFFFFF;
  --yellow: #FFC83D;
  --teal: #5FE3D0;
  --pink: #FF5FA2;      /* ombre du titre, étoiles */
  --pink-2: #FF7AA8;    /* bouton partager, avatar Tom */
  --lav: #D9CFEA;       /* rubans, labels, sous-textes */
  --card-purple: #2A1650;  /* panneau titre, rejoindre, dos cartes */
  --btn-purple: #3A2468;   /* boutons secondaires, opts non-sélectionnées */
  --icon-purple: #8F6BD1;
  --cream: #FFE9A6;     /* bordure dotted titre, pièce */
  --green: #5BE37D;     /* check, toggle ON */
  --shadow-hard: 0 0 0 3px #2B1B3D, 0 8px 0 3px #2B1B3D;
  --font-display: 'Lilita One', sans-serif;
  --font-hand: 'Patrick Hand', sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
  --sticker: drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--white);
  overflow-x: clip;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle, rgba(255, 95, 162, .4) 0 3px, transparent 4px),
    radial-gradient(circle, rgba(62, 224, 208, .35) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255, 200, 61, .35) 0 2px, transparent 3px);
  background-size: 72px 72px;
  background-position: 0 0, 36px 36px, 18px 54px;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

/* ─── écrans ─── */
.screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  min-height: 100dvh;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
}
.screen.active { display: flex; }

/* mascotte sticker (contour blanc) */
.sticker { filter: var(--sticker); }

/* ─── panneau titre accueil ─── */
.masthead { flex-shrink: 0; }
.signboard {
  background: var(--card-purple);
  border: 6px dotted var(--cream);
  border-radius: 24px;
  padding: 12px 10px 14px;
  text-align: center;
}
.signboard h1 {
  font-family: var(--font-display);
  font-weight: 400; /* Lilita One n'a qu'un poids */
  font-size: 36px;
  line-height: 1;
  color: var(--yellow);
  text-shadow:
    -2px -2px 0 var(--ink), 2px -2px 0 var(--ink),
    -2px 2px 0 var(--ink), 2px 2px 0 var(--ink),
    4px 6px 0 var(--pink);
}

/* ─── héros mascotte + bulle ─── */
.hero {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hero-mascot { height: 124px; width: auto; flex: none; }
.bubble {
  position: relative;
  background: var(--white);
  color: var(--ink);
  border-radius: 22px;
  padding: 12px 16px;
  font-size: 25px;
  line-height: 1.1;
  flex: 1;
}
.bubble::before {
  content: "";
  position: absolute;
  left: -8px; top: 50%;
  margin-top: -8px;
  width: 16px; height: 16px;
  background: var(--white);
  transform: rotate(45deg);
}

/* ─── rubans (double clip-path : liseré blanc + intérieur lavande) ─── */
.ribbon {
  display: inline-block;
  background: var(--white);
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
  padding: 3px;
}
.ribbon-in {
  display: block;
  background: var(--lav);
  color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
  padding: 5px 20px;
  font-family: var(--font-hand);
  font-size: 20px;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.1;
}

/* ─── cartes de mode ─── */
.mode-card {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 132px;
  background: var(--yellow);
  border: 5px solid var(--white);
  border-radius: 26px;
  box-shadow: var(--shadow-hard);
  padding: 0 12px 0 10px;
  margin-top: 28px;
  transition: transform .08s ease;
}
.mode-card:active { transform: translateY(4px); }
.mode-card.teal { background: var(--teal); }
.mode-mascot { height: 140px; width: auto; flex: none; margin-top: -56px; }
.mode-card.teal .mode-mascot { height: 128px; }
.mode-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-width: 0;
}
.mode-info .sub {
  font-size: 19px;
  color: var(--ink);
  line-height: 1;
}
.mode-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
}
.badge {
  font-family: var(--font-pixel);
  font-size: 8px;
  background: var(--ink);
  color: var(--yellow);
  padding: 7px 8px;
  border-radius: 12px;
  letter-spacing: .5px;
}
.go {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--white);
  border: 4px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  flex: none;
}
.soon { position: relative; }
.soon-tag {
  position: absolute;
  top: -12px; right: 12px;
  background: var(--pink-2);
  color: var(--white);
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 3px solid var(--white);
  z-index: 2;
}
.soon .go { opacity: .55; }

/* ─── carte rejoindre ─── */
.join-card {
  all: unset;
  box-sizing: border-box;
  min-height: 64px;
  border-radius: 26px;
  border: 4px solid var(--white);
  background: var(--card-purple);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  margin-top: 6px;
  font-family: var(--font-hand);
  font-size: 23px;
  text-align: left;
  position: relative;
  transition: transform .08s ease;
}
.join-card:active { transform: translateY(3px); }
.qr-ico {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--icon-purple);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  color: var(--white);
}
.join-txt { display: flex; flex-direction: column; }
.join-txt small { font-size: 18px; color: var(--lav); margin-left: auto; }
.join-card .soon-tag { top: auto; bottom: -12px; right: 12px; }
.home-foot {
  margin-top: auto;
  text-align: center;
  font-size: 19px;
  color: var(--lav);
}

/* ─── headers des écrans internes ─── */
.subhead {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.back {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--yellow);
  border: 4px solid var(--white);
  box-shadow: var(--shadow-hard);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  flex: none;
  transition: transform .08s ease;
}
.back:active { transform: translateY(3px); }
.subhead .ribbon-in { font-size: 22px; }
.head-mascot {
  height: 78px;
  width: auto;
  margin-left: auto;
  align-self: flex-start;
}

/* ─── steps setup ─── */
.steps { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; flex-direction: column; gap: 6px; }
.step > label, .step-label {
  font-size: 20px;
  color: var(--lav);
}
#conflict {
  height: 52px;
  border: 4px solid var(--white);
  border-radius: 18px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 24px;
  padding: 0 14px;
  outline: none;
  width: 100%;
}
#conflict::placeholder { color: #B9A8D6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  color: var(--ink);
  border-radius: 24px;
  padding: 4px 14px 4px 4px;
  font-family: var(--font-hand);
  font-size: 21px;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease;
}
.chip:active { transform: translateY(2px); }
.chip .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  flex: none;
}
.chip.ghost {
  min-height: 44px;
  align-self: flex-start;
  border-radius: 24px;
  border: 4px dashed var(--lav);
  background: none;
  color: var(--lav);
  font-family: var(--font-hand);
  font-size: 21px;
  padding: 0 14px;
  box-shadow: none;
}
.chip-input {
  border: 4px solid var(--white);
  border-radius: 24px;
  padding: 8px 16px;
  font-family: var(--font-hand);
  font-size: 21px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  width: 150px;
}

/* opts (thème, mécaniques) */
.opt-row { display: flex; gap: 8px; }
.opt-row.mech-row { gap: 10px; }
.opt {
  flex: 1;
  min-height: 44px;
  border-radius: 22px;
  border: 4px solid var(--white);
  background: var(--btn-purple);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 16px;
  cursor: pointer;
  transition: transform .08s ease;
}
.opt:active { transform: translateY(2px); }
.opt.sel { background: var(--yellow); color: var(--ink); }

.mech-grid { display: flex; gap: 10px; }
.mech {
  flex: 1;
  min-height: 92px;
  border-radius: 20px;
  border: 4px solid var(--white);
  background: var(--btn-purple);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .08s ease;
}
.mech:active { transform: translateY(2px); }
.mech .ico {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  flex: none;
}
.mech.wheel .ico {
  background: conic-gradient(var(--pink) 0 25%, var(--yellow) 0 50%, var(--teal) 0 75%, var(--icon-purple) 0);
}
.mech.coin .ico { background: var(--cream); }
.mech.cards .ico {
  width: 28px; height: 38px;
  border-radius: 6px;
  background: var(--white);
  font-size: 18px;
  color: var(--pink);
}
.mech.gacha .ico {
  background: linear-gradient(180deg, var(--yellow) 50%, var(--pink-2) 50%);
}
.mech.sel {
  background: var(--yellow);
  color: var(--ink);
  box-shadow: var(--shadow-hard);
}

/* ─── gros CTA ─── */
.bottom-cta { margin-top: auto; }
.big-cta {
  width: 100%;
  min-height: 64px;
  border-radius: 36px;
  border: 5px solid var(--white);
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 26px;
  box-shadow: var(--shadow-hard);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .08s ease;
}
.big-cta:active { transform: translateY(4px); }
.big-cta.pink { background: var(--pink-2); }
.big-cta:disabled { opacity: .45; cursor: not-allowed; }

/* ─── écran tirage ─── */
.draw-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 60vh;
}
.draw-msg {
  font-size: 20px;
  color: var(--lav);
  text-align: center;
  min-height: 28px;
}
#wheel { max-width: 100%; border-radius: 50%; }

/* pièce 3D */
.coin3d {
  width: 130px; height: 130px;
  perspective: 600px;
  margin: 10px 0;
}
.coin3d .inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.3, .7, .3, 1);
}
.coin3d .face, .coin3d .pile {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 30px; color: var(--ink);
  backface-visibility: hidden;
  border: 5px solid var(--white);
  box-shadow: var(--shadow-hard);
}
.coin3d .face { background: var(--yellow); }
.coin3d .pile { background: var(--cream); transform: rotateY(180deg); }

/* éventail de cartes */
.fan { position: relative; width: 100%; height: 240px; }
.fan .card {
  position: absolute;
  left: 50%; top: 20px;
  width: 110px; height: 160px;
  margin-left: -55px;
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .28);
  cursor: pointer;
  transition: transform .25s ease;
  transform-origin: 50% 130%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
}
.fan .card .inner {
  position: absolute; inset: 0;
  border-radius: 10px;
  background: var(--card-purple);
  display: flex; align-items: center; justify-content: center;
  color: var(--yellow);
  font-size: 40px;
  backface-visibility: hidden;
  transition: opacity .3s ease;
}
.fan .card .name {
  font-size: 19px;
  color: var(--ink);
  padding: 4px;
  text-align: center;
  overflow-wrap: anywhere;
}
.fan .card.flipped .inner { opacity: 0; }
.fan .card.flipped { cursor: default; }
.fan .card.win { background: var(--yellow); border-color: var(--yellow); }

/* ─── gachapon ─── */
.gacha-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.gacha-machine { position: relative; width: 240px; }
.gacha-dome {
  width: 200px; height: 100px;
  margin: 0 auto;
  border: 4px solid var(--ink);
  border-radius: 100px 100px 0 0;
  background: rgba(255, 255, 255, .22);
  position: relative;
  overflow: hidden;
}
.capsule-mini {
  position: absolute;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  box-sizing: border-box;
}
.capsule-mini.shaking { animation: capshake .12s linear 10; }
@keyframes capshake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-2px, 1px) rotate(-9deg); }
  50% { transform: translate(2px, -1px) rotate(9deg); }
  75% { transform: translate(-1px, 2px) rotate(-4deg); }
}
.gacha-body {
  width: 240px; height: 118px;
  background: var(--card-purple);
  border: 4px solid var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-hard);
  position: relative;
}
.gacha-chute {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: 10px;
  width: 72px; height: 46px;
  background: #0F0A20;
  border: 3px solid var(--ink);
  border-radius: 10px;
}
.gacha-knob {
  position: absolute;
  right: -34px; top: 36px;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--white);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-hard);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: transform 1.2s cubic-bezier(.25, .8, .3, 1);
}
.gacha-knob.spun { transform: rotate(720deg); }
.gacha-capsule {
  position: relative;
  width: 140px; height: 140px;
  cursor: pointer;
  margin: 6px auto 0;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  transition: transform .2s ease;
}
.gacha-capsule:active { transform: scale(.95); }
.cap-half {
  position: absolute;
  left: 0; right: 0;
  height: 50%;
  border: 4px solid var(--ink);
  box-sizing: border-box;
  transition: transform .45s cubic-bezier(.3, 1.2, .5, 1), opacity .45s ease;
}
.cap-top { top: 0; border-radius: 70px 70px 0 0; }
.cap-bottom { bottom: 0; border-radius: 0 0 70px 70px; }
.cap-name {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--ink);
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: 18px;
  text-align: center;
  padding: 0 10px;
  opacity: 0;
  transition: opacity .3s ease .18s;
  overflow-wrap: anywhere;
}
.gacha-capsule.open .cap-top { transform: translateY(-46px) rotate(-14deg); opacity: 0; }
.gacha-capsule.open .cap-bottom { transform: translateY(46px) rotate(14deg); opacity: 0; }
.gacha-capsule.open .cap-name { opacity: 1; }

/* ─── écran verdict ─── */
.verdict-card {
  position: relative;
  background: var(--yellow);
  border: 5px solid var(--white);
  border-radius: 30px;
  box-shadow: var(--shadow-hard);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
#verdict-conflict .ribbon-in { font-size: 17px; white-space: normal; text-align: center; }
#verdict-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(44px, 21vw, 84px);
  line-height: 1.1;
  color: var(--white);
  margin-top: 8px;
  text-shadow:
    -3px -3px 0 var(--ink), 3px -3px 0 var(--ink),
    -3px 3px 0 var(--ink), 3px 3px 0 var(--ink),
    6px 8px 0 var(--pink);
  overflow-wrap: anywhere;
  text-align: center;
}
#verdict-verb {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--ink);
}
.verdict-mascot { height: 200px; width: auto; margin-top: 6px; }
.star { position: absolute; line-height: 0; }
.star.st1 { left: 18px; top: 70px; }
.star.st2 { left: 300px; top: 110px; }
.star.st3 { left: 36px; top: 230px; }
.star.st4 { left: 290px; top: 260px; }

.check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 19px;
  color: var(--lav);
}
.check svg { color: var(--green); flex: none; }

.row-2 { display: flex; gap: 10px; }
.btn {
  flex: 1;
  min-height: 44px;
  border-radius: 22px;
  border: 4px solid var(--white);
  background: var(--btn-purple);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 16px;
  cursor: pointer;
  transition: transform .08s ease;
}
.btn:active { transform: translateY(2px); }

/* ─── toast ─── */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 18px;
  border-radius: 22px;
  padding: 12px 22px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── bouton son ─── */
.sound-toggle {
  position: fixed;
  top: 14px; right: 14px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background: var(--card-purple);
  font-size: 17px;
  cursor: pointer;
  z-index: 40;
  display: flex; align-items: center; justify-content: center;
}

@media (max-width: 360px) {
  .hero-mascot { height: 104px; }
  .mode-mascot { height: 118px; }
  .mode-card.teal .mode-mascot { height: 108px; }
  .signboard h1 { font-size: 30px; }
}

/* ─── desktop : colonne agrandie + hover + lisibilité à distance ───
   (le layout reste vertical : c'est l'ADN du produit — un écran qu'on tend.
   Le desktop servira surtout d'écran partagé ; le vrai layout large
   arrivera avec le lobby Pair Me v2 = « TV screen + phones as controllers ») */
@media (min-width: 900px) {
  #app { max-width: 520px; }
  .signboard h1 { font-size: 44px; }
  .hero-mascot { height: 150px; }
  .mode-mascot { height: 165px; margin-top: -66px; }
  .mode-card.teal .mode-mascot { height: 150px; }
  .mode-card { height: 148px; }
  .verdict-mascot { height: 240px; }
  #verdict-name { font-size: clamp(64px, 12vw, 96px); }
  .bubble { font-size: 28px; }
  .mode-card:hover, .big-cta:hover, .btn:hover, .join-card:hover, .chip:hover, .opt:hover, .mech:hover { transform: translateY(-2px); }
  .mode-card:hover { box-shadow: 0 0 0 3px #2B1B3D, 0 12px 0 3px #2B1B3D; }
  .big-cta:hover, .join-card:hover { box-shadow: 0 0 0 3px #2B1B3D, 0 12px 0 3px #2B1B3D; }
}
