/* Concept : un jeu de cartes à collectionner. Chaque ami du groupe devient une carte « personnage ».
   Une seule colonne, mobile d'abord, cartes posées sur une table bleu nuit (sombre) ou papier froid (clair). */
:root {
  --bg: #EEF0F8;
  --surface: #FFFFFF;
  --ink: #15172E;
  --muted: #5C6084;
  --line: #D6D9EA;
  --accent: #2335E8;
  --accent-ink: #FFFFFF;
  --sun: #FFD23F;
  --pink: #FF5DA2;
  --ok: #1F8A5B;
  --shadow: 0 1px 0 rgba(21, 23, 46, .06), 0 10px 30px -12px rgba(21, 23, 46, .25);
  --font-display: "Bagel Fat One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-body: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1022; --surface: #1A1D38; --ink: #EEF0FF; --muted: #A3A7CC; --line: #2D3158;
    --accent: #6F7CFF; --accent-ink: #0E1022; --sun: #FFD84F; --pink: #FF77B2; --ok: #4FD49A;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 34px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1022; --surface: #1A1D38; --ink: #EEF0FF; --muted: #A3A7CC; --line: #2D3158;
  --accent: #6F7CFF; --accent-ink: #0E1022; --sun: #FFD84F; --pink: #FF77B2; --ok: #4FD49A;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 34px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wrap {
  max-width: 560px; margin: 0 auto;
  padding-block: 20px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 22px;
}
h1, h2, h3 { margin: 0; text-wrap: balance; line-height: 1.08; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.1rem, 8vw, 3rem); letter-spacing: -.01em; }
h2 { font-weight: 800; font-size: 1.35rem; }
h3 { font-weight: 800; font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.eyebrow { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Boutons */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  border-radius: 999px; padding: 15px 22px; min-height: 52px;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, filter .12s ease;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.sun { background: var(--sun); color: #15172E; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.link { background: none; border: 0; padding: 4px 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

/* Champs */
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
input[type="text"] {
  font: inherit; font-size: 1.05rem; width: 100%;
  padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink);
}
input[type="text"]:focus { border-color: var(--accent); outline: none; }
.friend-row { display: flex; gap: 8px; }
.friend-row input { flex: 1; min-width: 0; }
.icon-btn {
  flex: none; width: 50px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 1.3rem; cursor: pointer;
}
.panel { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.error { color: #D6336C; font-weight: 600; }

/* Accueil : éventail de cartes */
.hero { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.hero h1 .hl { color: var(--accent); }
.fan { position: relative; height: 190px; margin: 4px 0 0; }
.fan .mini {
  position: absolute; left: 50%; top: 10px; width: 116px; height: 158px; border-radius: 14px;
  background: var(--c); color: #fff; padding: 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: space-between;
  transform-origin: 50% 120%;
  transform: translateX(-50%) rotate(var(--r)) translateY(var(--y, 0));
  border: 3px solid rgba(255, 255, 255, .85);
}
.fan .mini .em { font-size: 2.3rem; line-height: 1; }
.fan .mini .nm { font-family: var(--font-display); font-size: .95rem; line-height: 1.05; }
@media (prefers-reduced-motion: no-preference) {
  .fan .mini { animation: deal .6s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 70ms); }
  @keyframes deal { from { transform: translateX(-50%) rotate(0deg) translateY(30px); } }
}
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.steps div { background: var(--surface); border-radius: 14px; padding: 12px; font-size: .88rem; box-shadow: var(--shadow); }
.steps b { display: block; font-size: 1.4rem; font-family: var(--font-display); font-weight: 400; color: var(--accent); }

/* Groupe */
.group-head { display: flex; flex-direction: column; gap: 10px; }
.progress { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.share-box { display: flex; gap: 8px; }
.share-box input { flex: 1; min-width: 0; font-size: .9rem; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.who {
  appearance: none; font: inherit; cursor: pointer; text-align: left;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 16px; padding: 12px; display: flex; gap: 10px; align-items: center; min-width: 0;
}
.who:hover:not(:disabled) { border-color: var(--accent); }
.who:disabled { opacity: .5; cursor: not-allowed; }
.who .nm { font-weight: 800; overflow-wrap: anywhere; }
.who small { display: block; color: var(--muted); font-size: .78rem; }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: #fff; background: var(--c, var(--accent)); font-size: 1rem;
}

/* Carte personnage */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pcard {
  --c: var(--accent);
  position: relative; border-radius: 18px; padding: 14px; min-width: 0;
  background: var(--c); color: #fff; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
  border: 3px solid rgba(255, 255, 255, .8);
  overflow: hidden;
}
.pcard::after {
  content: ""; position: absolute; inset: auto -30% -55% auto; width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); pointer-events: none;
}
.pcard .em { font-size: 2.4rem; line-height: 1; }
.pcard .who-name { font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; }
.pcard .role { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.05; }
.pcard .meta { font-size: .78rem; opacity: .9; }
.pcard.me { outline: 3px solid var(--sun); outline-offset: 3px; }
.pcard.pending { background: var(--surface); color: var(--muted); border: 2px dashed var(--line); }
.pcard .badge {
  position: absolute; top: 10px; right: 10px; font-size: .68rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; background: rgba(0, 0, 0, .22); padding: 3px 8px; border-radius: 99px;
}

.big-card { padding: 22px; gap: 10px; }
.big-card .em { font-size: 4.2rem; }
.big-card .role { font-size: 2rem; }
.big-card .tagline { font-size: 1.05rem; font-weight: 600; }
.meter { height: 8px; background: rgba(255, 255, 255, .25); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.insights { display: flex; flex-direction: column; gap: 10px; }
.insight { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.insight .ico { font-size: 1.4rem; line-height: 1.2; flex: none; }
.insight p { min-width: 0; }
.traits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.traits div { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 10px; font-size: .88rem; }
.traits b { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }

.titles { display: flex; flex-direction: column; gap: 8px; }
.title-row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.title-row .q { flex: 1; min-width: 0; font-size: .92rem; }
.title-row .q b { display: block; font-size: 1rem; }
.title-row .n { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* Quiz */
.quiz { display: flex; flex-direction: column; gap: 20px; min-height: calc(100vh - 120px); }
.quiz-top { display: flex; align-items: center; gap: 12px; }
.quiz-top .progress { flex: 1; }
.quiz-top .count { font-variant-numeric: tabular-nums; font-weight: 800; font-size: .9rem; color: var(--muted); }
.chip { align-self: flex-start; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 6px 12px; border-radius: 99px; background: var(--sun); color: #15172E; }
.chip.groupe { background: var(--pink); color: #fff; }
.chip.verdict { background: var(--accent); color: var(--accent-ink); }
.question { font-size: clamp(1.45rem, 5.6vw, 1.9rem); font-weight: 800; line-height: 1.15; text-wrap: balance; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  appearance: none; font: inherit; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 2px solid var(--line);
  border-radius: 16px; padding: 16px; font-size: 1.02rem; font-weight: 600;
  display: flex; gap: 12px; align-items: center; min-height: 60px;
  transition: border-color .12s ease, transform .12s ease;
}
.opt:hover { border-color: var(--accent); }
.opt:active { transform: scale(.99); }
.opt .k {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--bg); color: var(--muted); font-weight: 800; font-size: .85rem;
}
.opt.vote-opt { padding: 12px 14px; }
.hint { font-size: .9rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .q-anim { animation: rise .32s ease both; }
  @keyframes rise { from { opacity: .3; transform: translateY(10px); } }
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 99px; font-weight: 600;
  box-shadow: var(--shadow); z-index: 20; max-width: calc(100% - 32px);
}
.dev-note { font-size: .82rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 14px; }
@media (max-width: 380px) {
  .steps { grid-template-columns: 1fr; }
  .traits { grid-template-columns: 1fr; }
}

/* Pied de page, pages légales, suppression */
.site-footer {
  max-width: 560px; margin: 0 auto;
  padding-block: 8px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .85rem;
}
.site-footer a { color: var(--muted); }
.legal { gap: 18px; padding-bottom: 24px; }
.legal section { display: flex; flex-direction: column; gap: 8px; }
.legal ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.legal a { color: var(--accent); }
.legal a.link { color: var(--muted); align-self: flex-start; }
.todo { background: var(--sun); color: #15172E; padding: 0 4px; border-radius: 4px; }
.danger-zone { border-top: 1px dashed var(--line); padding-top: 14px; }
.btn.danger { background: #D6336C; color: #fff; }

/* Choix du type de groupe */
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kind {
  appearance: none; font: inherit; cursor: pointer; min-width: 0;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 12px 8px; font-weight: 700; font-size: .92rem;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.kind:hover { border-color: var(--accent); }
.kind[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.kind-em { font-size: 1.6rem; line-height: 1; }
.new-group { outline: 3px solid var(--sun); }
@media (max-width: 380px) { .kinds { grid-template-columns: 1fr; } .kind { flex-direction: row; justify-content: center; } }
