/* Figure-in (version light) — style volontairement simple, sans police externe. */
:root {
  --fond: #f2f2f2; --carte: #fff; --carte2: #f4f4f4; --encre: #0b0b0b; --doux: #5c5c5c;
  --ligne: #d2d2d2; --accent: #0b0b0b; --sur-accent: #fff; --ok: #2a9d68; --erreur: #c0392b;
  --C: #8a94a6; --R: #2f8bf0; --E: #a24cf0; --L: #f0a21c; --S: #e8368f;
  --ombre: 0 8px 22px -16px rgba(0, 0, 0, .4);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #000; --carte: #141414; --carte2: #1e1e1e; --encre: #f5f5f5; --doux: #a8a8a8;
    --ligne: #363636; --accent: #fff; --sur-accent: #000; --erreur: #ff7b6b;
    --ombre: 0 8px 22px -16px rgba(0, 0, 0, .9);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--fond); color: var(--encre);
  font: 500 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }

#app {
  max-width: 560px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
#app > * + * { margin-top: 14px; }

/* En-tête */
.haut { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.haut a { font-weight: 700; text-decoration: none; }
.solde {
  background: var(--accent); color: var(--sur-accent); border-radius: 99px; padding: 6px 12px;
  font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: var(--ombre);
}
.bump { animation: bump .45s; }
@keyframes bump { 40% { transform: scale(1.2); } }
.titre h1 { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.titre p { color: var(--doux); font-size: 14px; }

.acces {
  background: var(--carte); border: 1px solid var(--ligne); border-left: 5px solid var(--L);
  border-radius: 14px; padding: 12px 14px; font-weight: 600;
}
.acces a { font-weight: 800; }

/* Cartes */
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 20px; padding: 16px; box-shadow: var(--ombre); }
.carte > * + * { margin-top: 12px; }
.coffre { border-color: var(--accent); }
.coffre-tete { display: flex; align-items: center; gap: 14px; }
.coffre-ico { font-size: 44px; line-height: 1; }
.coffre-tete h2 { font-size: 19px; font-weight: 800; }
.coffre-tete p { color: var(--doux); font-size: 13px; margin-top: 2px; }
.fin { color: var(--doux); font-size: 12px; }
.fin:empty { display: none; }

.probas { display: flex; flex-wrap: wrap; gap: 6px; }
.probas span { background: var(--c); color: #fff; font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.probas .r-L { color: #3a2600; }

/* Boutons */
.btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; background: var(--accent); color: var(--sur-accent); border-radius: 14px;
  padding: 12px 10px; font-weight: 800; transition: transform .1s;
}
.btn b { font-size: 18px; }
.btn small { font-size: 11px; font-weight: 700; opacity: .9; }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.sec { background: var(--carte2); color: var(--encre); border: 1px solid var(--ligne); font-size: 14px; padding: 11px; }
.btn.sec.pret { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sec.confirmer { background: var(--erreur); border-color: var(--erreur); color: #fff; }
.achats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.message { font-size: 13px; font-weight: 700; border-radius: 12px; padding: 9px 12px; background: var(--carte2); }
.message.ok { color: var(--ok); }
.message.erreur { color: var(--erreur); }

/* Collection */
.progression { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.progression h2 { font-size: 18px; font-weight: 800; }
.progression p { color: var(--doux); font-weight: 700; font-variant-numeric: tabular-nums; }
.progression b { color: var(--encre); font-size: 18px; }
.barre { height: 8px; background: var(--ligne); border-radius: 9px; overflow: hidden; }
.barre i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 9px; transition: width .5s; }

.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.filtres button {
  border: 1px solid var(--ligne); background: var(--carte); border-radius: 99px;
  padding: 6px 11px; font-size: 12.5px; font-weight: 700;
}
.filtres button small { opacity: .7; margin-left: 3px; }
.filtres button[aria-pressed="true"] { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #fff; }
.filtres button.r-L[aria-pressed="true"] { color: #3a2600; }
.filtres button:not([class*="r-"])[aria-pressed="true"] { color: var(--sur-accent); }

.groupe {
  display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 8px;
  padding: 8px 12px; border-radius: 12px; background: var(--c); color: #fff; font-weight: 800;
}
.groupe:first-child { margin-top: 0; }
.groupe small { font-size: 12px; }
.groupe.r-L { background: linear-gradient(90deg, #f7cf55, #dca02c); color: #3a2600; }
.groupe.r-S { background: linear-gradient(90deg, #ff9bd6, #ffe08a, #9bffe0, #9bc4ff); color: #1b1030; }

.grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fig {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  aspect-ratio: 3 / 4; background: var(--carte); border: 2px solid var(--c, var(--ligne));
  border-radius: 16px; padding: 6px 2px;
}
.fig .dessin { width: 80%; max-width: 92px; }
.fig .art { display: block; width: 100%; height: auto; }
.fig .nom { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.15; padding: 0 2px; }
.fig .num { position: absolute; top: 5px; left: 10px; font-size: 9px; font-weight: 700; color: var(--doux); }
.fig .nb {
  position: absolute; top: 3px; right: 4px; font-size: 10px; font-weight: 800;
  color: var(--sur-accent); background: var(--accent); border-radius: 99px; padding: 1px 6px;
}
.fig.absente { border-style: dashed; border-color: var(--ligne); background: var(--carte2); }
.fig.absente .inconnu { font-size: 30px; font-weight: 800; color: var(--ligne); }
.fig.absente .nom { color: var(--doux); }
.fig.r-L:not(.absente) { background: linear-gradient(160deg, #fff6d6, #f7cf55); color: #3a2600; }
.fig.r-S:not(.absente) { background: linear-gradient(160deg, #ffe3f3, #e3f0ff); color: #1b1030; }
.fig .neuve {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--ok); color: #fff; font-size: 9.5px; font-weight: 800; border-radius: 99px; padding: 2px 7px;
}
.r-C { --c: var(--C); } .r-R { --c: var(--R); } .r-E { --c: var(--E); } .r-L { --c: var(--L); } .r-S { --c: var(--S); }

.legal { color: var(--doux); font-size: 11.5px; text-align: center; }

/* Résultat d'ouverture */
.voile {
  position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.voile[hidden] { display: none; }
.fenetre {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; background: var(--carte);
  border-radius: 22px; padding: 18px; box-shadow: var(--ombre);
}
.fenetre > * + * { margin-top: 12px; }
.fenetre h2 { font-size: 20px; font-weight: 800; text-align: center; }
.fenetre .fin { text-align: center; }
.butin { padding-bottom: 8px; }
.butin.serre { grid-template-columns: repeat(5, 1fr); gap: 12px 6px; }
.butin.serre .nom { font-size: 8px; line-height: 1.1; }
.butin.serre .nb { display: none; }
.butin.serre .neuve { font-size: 7.5px; padding: 1px 5px; bottom: -7px; }

/* Collection : outils, groupes repliables, fiche */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme select {
  background: var(--carte); color: var(--encre); border: 1px solid var(--ligne); border-radius: 99px;
  padding: 5px 8px; font: inherit; font-size: 12.5px; font-weight: 700; max-width: 40vw;
}
.objectif { color: var(--doux); font-size: 12.5px; font-weight: 700; }
.objectif:empty { display: none; }
.outils { display: flex; flex-direction: column; gap: 8px; }
.outils input[type=search] {
  width: 100%; background: var(--carte2); color: var(--encre); border: 1px solid var(--ligne);
  border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14px;
}
.tris { display: flex; flex-wrap: wrap; gap: 6px; }
.tris button {
  border: 1px solid var(--ligne); background: var(--carte); border-radius: 99px; padding: 6px 11px;
  font-size: 12.5px; font-weight: 700;
}
.tris button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.tris button:disabled { opacity: .4; cursor: not-allowed; }

button.groupe { width: 100%; text-align: left; cursor: pointer; transition: transform .1s; flex-wrap: wrap; align-items: center; }
button.groupe:active { transform: scale(.985); }
button.groupe .chv { display: inline-block; margin-left: 4px; transition: transform .2s; }
button.groupe.plie .chv { transform: rotate(-90deg); }
.groupe .progres { flex-basis: 100%; height: 5px; margin-top: 6px; border-radius: 9px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.groupe .progres i { display: block; height: 100%; background: #fff; border-radius: 9px; }
.groupe.r-L .progres { background: rgba(58, 38, 0, .2); } .groupe.r-L .progres i { background: #3a2600; }
.groupe.r-S .progres { background: rgba(27, 16, 48, .18); } .groupe.r-S .progres i { background: #1b1030; }
.grille.d4 { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grille.d4 .fig .nom { font-size: 9.5px; }
.grille.d4 .fig .num { left: 6px; }
.fig[role=button] { cursor: pointer; }
.vide { grid-column: 1 / -1; text-align: center; color: var(--doux); padding: 26px 0; }

.fiche { text-align: center; }
.fiche .grand { width: 150px; margin: 0 auto; }
.fiche .grand .art { display: block; width: 100%; height: auto; }
.fiche .inconnue { font-size: 96px; font-weight: 800; color: var(--ligne); line-height: 1.1; }
.fiche .badge { display: inline-block; background: var(--c); color: #fff; font-weight: 800; font-size: 12px; border-radius: 99px; padding: 3px 11px; }
.fiche.r-L .badge { color: #3a2600; }
.fiche .doux { color: var(--doux); font-size: 13px; }
.fiche .nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fiche .nav .btn { width: 56px; }
.partage-img { display: block; width: 100%; height: auto; border-radius: 14px; }

@media (prefers-reduced-motion: reduce) {
  .bump { animation: none; }
  .barre i, .btn, button.groupe, button.groupe .chv { transition: none; }
}

/* ---- Figure-in complet : garanties, Halloween, défis, succès, profil, code ---- */
.garanties { display: grid; gap: 10px; }
.garantie { background: var(--carte2); border: 1px solid var(--ligne); border-radius: 12px; padding: 10px 12px; }
.garantie > * + * { margin-top: 6px; }
.garantie-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.garantie-tete small { color: var(--doux); font-weight: 700; }

.halloween { border-color: #ff7a1a; background: color-mix(in srgb, #ff7a1a 7%, var(--carte)); }
.halloween .achats { display: grid; gap: 8px; }

.defis-liste, .succes-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.defis-liste li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--carte2); border: 1px solid var(--ligne); border-radius: 12px; padding: 10px 12px; }
.defis-liste li.fait { opacity: .7; }
.defi-texte { flex: 1; min-width: 0; display: grid; gap: 4px; }
.defi-texte small { color: var(--doux); }
.defis-liste .btn { width: auto; min-width: 104px; padding: 8px 12px; }

.succes-liste li { background: var(--carte2); border: 1px solid var(--ligne); border-radius: 12px; padding: 8px 12px; }
.succes-liste li.fait { border-color: var(--ok); }
.succes-liste li > div { display: grid; gap: 2px; }
.succes-liste small { color: var(--doux); }
#succes summary { cursor: pointer; font-weight: 700; padding: 6px 0; }

.profil-apercu { display: flex; align-items: center; gap: 12px; }
.profil-apercu small { display: block; color: var(--doux); }
.profil-avatar { width: 64px; height: 64px; display: grid; place-items: center; font-size: 34px;
  background: var(--carte2); border: 1px solid var(--ligne); border-radius: 16px; overflow: hidden; }
.profil-avatar .art { width: 100%; height: 100%; }
.profil-form { display: grid; gap: 10px; }
.profil-form label { display: grid; gap: 4px; font-weight: 700; font-size: 13px; }
.profil-form select, #codeChamp { font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ligne);
  background: var(--carte); color: var(--encre); min-height: 44px; }
.code-ligne { display: flex; gap: 8px; }
.code-ligne #codeChamp { flex: 1; min-width: 0; }
.code-ligne .btn { width: auto; padding: 10px 16px; }

.bonus-butin { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; text-align: center; font-weight: 700; font-size: 13px; }
.groupe-fixe { margin: 14px 0 6px; font-weight: 800; color: var(--doux); text-transform: uppercase; font-size: 12px; letter-spacing: .5px; }

/* Ligne de profil et onglets (même principe que Fantasy Collector) */
.barre-profil {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--carte); border: 1px solid var(--ligne); border-radius: 16px; padding: 8px 12px;
}
.barre-profil[hidden], .onglets[hidden], .vue[hidden] { display: none; }
.barre-profil .qui { display: flex; align-items: center; gap: 10px; min-width: 0; }
.barre-profil .qui > div { display: flex; flex-direction: column; min-width: 0; }
.barre-profil b, .barre-profil small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-profil small { color: var(--doux); font-size: 12px; }
.barre-profil .ava {
  width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--fond); border: 1px solid var(--ligne);
}
.barre-profil .ava svg { width: 100%; height: 100%; }
.barre-profil .pieces { font-weight: 800; white-space: nowrap; }
.onglets { display: flex; gap: 8px; }
.onglets button {
  flex: 1; font-weight: 800; font-size: 15px; padding: 9px 6px; border-radius: 12px;
  border: 1.5px solid var(--ligne); background: var(--carte);
}
.onglets button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.vue > * + * { margin-top: 14px; }
