:root {
  --fond: #f4f6fb;
  --surface: #ffffff;
  --texte: #0f172a;
  --muted: #64748b;
  --bord: #e2e8f0;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --danger: #dc2626;
  --ok: #16a34a;
  --attente: #d97706;
  --ombre: 0 1px 2px rgb(15 23 42 / .04), 0 8px 24px rgb(15 23 42 / .06);
  --rayon: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0b1020;
    --surface: #131a2e;
    --texte: #e2e8f0;
    --muted: #94a3b8;
    --bord: #24304d;
    --accent: #818cf8;
    --ombre: 0 8px 24px rgb(0 0 0 / .35);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.6 Inter, system-ui, sans-serif;
  background: var(--fond);
  color: var(--texte);
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.8rem; letter-spacing: -.02em; margin: .2em 0 .4em; }
h2 { font-size: 1.15rem; margin: 1.6em 0 .6em; }
.muted { color: var(--muted); }

/* Barre du haut */
.barre {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px max(16px, calc((100% - 1100px) / 2));
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bord);
}
.logo { font-weight: 700; color: var(--texte); display: flex; gap: 8px; align-items: center; }
.logo span {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
nav { display: flex; gap: 4px; flex: 1 0 auto; flex-wrap: wrap; }
nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
nav a:hover { color: var(--texte); background: var(--fond); }
nav a.actif { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* Onglet Administrateur, en orange */
nav a.onglet-admin { color: #ea580c; font-weight: 600; }
nav a.onglet-admin:hover { background: color-mix(in srgb, #f97316 12%, transparent); color: #ea580c; }
nav a.onglet-admin.actif { color: #fff; background: linear-gradient(135deg, #f97316, #ea580c); }
@media (prefers-color-scheme: dark) { nav a.onglet-admin:not(.actif) { color: #fb923c; } }
.entete-admin { display: flex; align-items: center; gap: 12px; }
.tuiles-admin { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.carte.tuile { position: relative; display: flex; align-items: center; gap: 14px; margin: 0; }
.tuile:hover { border-color: #f97316; }
.tuile-icone {
  flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 24px;
  background: color-mix(in srgb, #f97316 14%, transparent);
}
.tuile .badge { position: absolute; top: 12px; right: 12px; }
.badge { background: var(--danger); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
.qui { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); }

/* Bannières */
.bannieres {
  display: grid; grid-template-columns: 2fr 1fr; gap: 16px;
  max-width: 1100px; margin: 20px auto 0; padding: 0 16px;
}
.banniere { border-radius: var(--rayon); padding: 18px 22px; box-shadow: var(--ombre); }
.banniere h2 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.banniere p { margin: 0 0 12px; }
.infos { color: #fff; background: linear-gradient(135deg, var(--accent), #7c3aed 60%, var(--accent-2)); }
.techs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.techs li { background: rgb(255 255 255 / .16); border-radius: 10px; padding: 6px 12px; display: flex; gap: 10px; }
.techs a { color: #fff; font-weight: 600; }
.point { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; margin-right: 6px; box-shadow: 0 0 0 3px rgb(74 222 128 / .3); }
.banniere .en-ligne { margin: 0 0 10px; font-size: 14px; }
.banniere .en-ligne:last-child { margin: 12px 0 0; }
.banniere .en-ligne a { color: #fff; font-weight: 600; text-decoration: underline; }
/* Bloc repliable : le bouton n'apparaît que sur téléphone */
.bloc-bannieres > summary { display: none; }
.moi { background: var(--surface); border: 1px solid var(--bord); }
.moi h2 { display: flex; justify-content: space-between; }
.modifier { text-transform: none; letter-spacing: 0; font-weight: 600; }
.moi dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.moi dt { color: var(--muted); }
.moi dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

/* Cartes et listes */
.carte {
  display: block; background: var(--surface); border: 1px solid var(--bord);
  border-radius: var(--rayon); padding: 18px 20px; box-shadow: var(--ombre); margin-bottom: 14px;
}
.carte h2, .carte h3 { margin: .3em 0; }
.lien { color: var(--texte); transition: transform .15s, border-color .15s; }
.lien:hover { transform: translateY(-2px); border-color: var(--accent); }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.grille .carte { margin: 0; }
.tag {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.proc .contenu { font-size: 1rem; margin: 18px 0; }
.contenu { overflow-wrap: anywhere; }
.liste { list-style: none; padding: 0; }
.liste li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.statut { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; color: #fff; }
.statut.attente { background: var(--attente); }
.statut.refusee { background: var(--danger); }
.statut.validee { background: var(--ok); }
.vide { text-align: center; color: var(--muted); padding: 40px 0; }
.flash {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid var(--accent);
  padding: 10px 16px; border-radius: 10px;
}
.retour { display: inline-block; margin-bottom: 12px; }
details { margin: 10px 0; }
summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.entete { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.recherche input { width: 260px; max-width: 100%; }

/* Formulaires */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 420px; }
.form.large { max-width: 760px; }
label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
input, textarea, select {
  font: inherit; color: var(--texte); background: var(--surface);
  border: 1px solid var(--bord); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ligne input { flex: 1; min-width: 120px; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px;
  padding: 9px 18px; color: #fff; background: var(--accent); justify-self: start;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondaire { background: var(--fond); color: var(--texte); border: 1px solid var(--bord); }
.btn.danger { background: var(--danger); }
.btn.petit { padding: 5px 12px; font-size: 13px; }
.centre { max-width: 460px; margin: 6vh auto; padding: 28px; }
.centre .form { max-width: none; }
.logo.grand { font-size: 1.1rem; margin-bottom: 18px; }
.onglets { display: grid; grid-template-columns: 1fr 1fr; background: var(--fond); border-radius: 10px; padding: 4px; margin-bottom: 8px; }
.onglets a { text-align: center; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.onglets a[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--ombre); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
small, .petit-texte { color: var(--muted); font-weight: 400; font-size: 13px; }
.btn.plein { justify-self: stretch; padding: 11px; }
.tech { display: grid; gap: 8px; justify-items: start; }
.tech h3 { display: flex; align-items: center; }
.btn.appel { padding: 7px 14px; }
.rang { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--fond); border: 1px solid var(--bord); }
.rang.admin { color: var(--accent); border-color: var(--accent); }
.rang.superadmin { color: #fff; border: 0; background: linear-gradient(135deg, #f59e0b, #ef4444); }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.galerie:empty { display: none; }
.galerie img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--bord); display: block; }
.vignette { position: relative; }
.vignette button {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgb(0 0 0 / .6); color: #fff; font-size: 14px;
}
.vignette button:hover { background: var(--danger); }
.vignette .numero {
  position: absolute; top: 6px; left: 6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent);
}
/* Photo placée dans le texte d'une procédure ([photo N]) */
.photo-inline { display: block; width: fit-content; max-width: 100%; margin: 10px 0; }
.photo-inline img { display: block; max-width: min(100%, 720px); max-height: 520px; border-radius: 10px; border: 1px solid var(--bord); cursor: zoom-in; }
.photo-inline:hover img { border-color: var(--accent); }
code { font-size: .9em; padding: 1px 5px; border-radius: 4px; background: var(--fond); }
.galerie a:hover img { border-color: var(--accent); }
.filtres { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 18px; }
.filtres a { padding: 5px 14px; border-radius: 99px; border: 1px solid var(--bord); background: var(--surface); color: var(--texte); font-size: 14px; font-weight: 500; }
.filtres a:hover { border-color: var(--accent); }
.filtres a.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.filtres a.gerer { color: var(--muted); border-style: dashed; }
.pousse { margin-left: auto; }
input[type="file"] { padding: 8px; }
/* Chat */
.chat { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: min(78vh, 720px); margin: 0; }
.chat-tete { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--bord); }
.chat-tete h1 { font-size: 1.05rem; margin: 0; letter-spacing: 0; }
.chat-tete p { margin: 0; font-size: 13px; }
.chat-icone {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.pile-avatars { margin-left: auto; display: flex; }
.pile-avatars .avatar { width: 30px; height: 30px; font-size: 11px; margin-left: -8px; border: 2px solid var(--surface); }

#messages {
  flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 2px;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 40%),
    radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--accent-2) 7%, transparent), transparent 40%),
    var(--fond);
}
.jour {
  align-self: center; margin: 14px 0 8px; padding: 3px 12px; border-radius: 99px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--surface); border: 1px solid var(--bord);
}
.ligne-msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.ligne-msg.suite { margin-top: 2px; }
.ligne-msg.mien { justify-content: flex-end; }
.ligne-msg.nouveau { animation: arrivee .25s ease-out; }
@keyframes arrivee { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .ligne-msg.nouveau { animation: none; } }

.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: hsl(var(--h, 240) 60% 50%);
}
.avatar.vide { visibility: hidden; }
.corps { display: flex; flex-direction: column; max-width: min(72%, 560px); }
.mien .corps { align-items: flex-end; }
.tete { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 3px 12px; display: flex; gap: 6px; align-items: center; }
.rang-chat { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.rang-chat.superadmin { color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444); }

.bulle {
  position: relative; padding: 8px 14px 6px; border-radius: 18px; background: var(--surface);
  border: 1px solid var(--bord); box-shadow: 0 1px 2px rgb(15 23 42 / .06);
}
.ligne-msg:not(.mien):not(.suite) .bulle { border-bottom-left-radius: 6px; }
.mien .bulle {
  color: #fff; border: 0; background: linear-gradient(135deg, var(--accent), #7c3aed);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.ligne-msg.mien:not(.suite) .bulle { border-bottom-right-radius: 6px; }
.bulle p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 15px; line-height: 1.45; }
.heure { display: block; text-align: right; font-size: 11px; opacity: .55; margin-top: 2px; }
.bulle.emoji-seul { background: none; border: 0; box-shadow: none; padding: 0 4px; color: var(--texte); }
.bulle.emoji-seul p { font-size: 40px; line-height: 1.15; }
.effacer {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer;
  font-size: 11px; color: #fff; background: var(--danger); opacity: 0; transition: opacity .15s;
}
.bulle:hover .effacer, .effacer:focus-visible { opacity: 1; }
/* Écran tactile : pas de survol, donc ✕ toujours visible mais discret. */
@media (hover: none) { .effacer { opacity: 1; background: rgb(15 23 42 / .35); } }
.chat-vide { margin: auto; text-align: center; color: var(--texte); }
.chat-vide .grand { font-size: 48px; }
.chat-vide p { margin: 4px 0; }

.chat-pied { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.chat-admin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-admin label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.chat-admin select { width: auto; padding: 5px 8px; }
.saisie { position: relative; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--bord); background: var(--surface); }
.champ-msg {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px;
  background: var(--fond); border: 1px solid var(--bord); border-radius: 99px; transition: border-color .15s;
}
.champ-msg:focus-within { border-color: var(--accent); }
.champ-msg input { border: 0; background: none; padding: 8px 6px; outline: none; }
.champ-msg input:focus { outline: none; }
#bouton-emoji { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; font-size: 20px; cursor: pointer; }
#bouton-emoji:hover, #bouton-emoji[aria-expanded="true"] { background: var(--surface); }
.envoi {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--accent), #7c3aed); transition: transform .1s;
}
.envoi:hover { transform: scale(1.06); }
.envoi:active { transform: scale(.95); }
#emojis {
  position: absolute; bottom: calc(100% + 8px); left: 16px; width: min(360px, calc(100% - 32px)); padding: 10px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; box-shadow: 0 12px 32px rgb(15 23 42 / .18);
  z-index: 5;
}
#emojis[hidden] { display: none; }
#emojis button { font-size: 22px; line-height: 1; padding: 6px 0; border: 0; border-radius: 8px; background: none; cursor: pointer; transition: transform .1s; }
#emojis button:hover { background: var(--fond); transform: scale(1.2); }
/* Bannière d'annonce : une seule copie du texte, qui part du bord droit (padding-left: 100 %)
   et sort entièrement à gauche (-100 % = largeur de l'écran + texte) avant de recommencer. */
.annonce { overflow: hidden; white-space: nowrap; font-weight: 600; font-size: 15px; padding: 9px 0; border-radius: 0; }
form .annonce { border-radius: 10px; margin-top: 6px; }
.defile { display: inline-block; padding-left: 100%; animation: defiler var(--duree, 30s) linear infinite; }
.defile span + span { margin-left: 560px; } /* = ECART_ANNONCES dans app.php : un message arrive quand le précédent s'en va */
.annonce:hover .defile { animation-play-state: paused; }
@keyframes defiler { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .defile { animation: none; white-space: normal; display: block; padding: 0 16px; }
  .defile span { display: block; margin: 0; }
}
.messages-annonce { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.messages-annonce legend { font-weight: 500; font-size: 14px; padding: 0; margin-bottom: 6px; }
#annonce-messages { display: grid; gap: 8px; }
.messages-annonce > .btn { justify-self: start; }
.ligne .pastille { flex: none; width: 52px; height: 40px; padding: 3px; cursor: pointer; }
.couleurs-rapides { display: flex; gap: 6px; flex-wrap: wrap; }
.couleurs-rapides button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--bord); cursor: pointer; }
.case { display: flex; gap: 8px; align-items: center; }
.case input { width: auto; }
/* Coin détente */
.onglets.jeux { grid-template-columns: repeat(4, 1fr); max-width: 600px; margin: 0 auto 18px; }
/* La roue */
.roue-cadre { position: relative; width: min(100%, 360px); }
#roue { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; box-shadow: var(--ombre), 0 0 0 6px var(--surface), 0 0 0 7px var(--bord); }
.roue-fleche {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 0; height: 0;
  border: 14px solid transparent; border-top: 24px solid var(--danger); filter: drop-shadow(0 2px 2px rgb(0 0 0 / .35));
}
.roue-resultat { min-height: 1.6em; font-size: 1.15rem; text-align: center; margin: 4px 0; }
.roue-resultat strong { color: var(--accent); }
.roue-choix { width: min(100%, 560px); }
.roue-choix.verrouille { opacity: .6; pointer-events: none; }
.roue-entete { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.roue-noms { display: flex; flex-wrap: wrap; gap: 8px; }
.roue-nom { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--bord); border-radius: 99px; cursor: pointer; }
.roue-nom:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.roue-nom.invite { border-style: dashed; }
.roue-retirer { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 0 0 4px; }
.roue-ajout { display: flex; gap: 8px; margin-top: 12px; }
.roue-ajout input { flex: 1; min-width: 0; }
.onglets.jeux button { font: inherit; text-align: center; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 600; cursor: pointer; }
.onglets.jeux button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--ombre); }
.jeu[hidden] { display: none; }
.jeu > .btn { justify-self: center; }
.jeu > p { margin: 0; }
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: min(100%, 400px); }
.carte-memory {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; border-radius: 14px;
  font-size: clamp(28px, 8vw, 40px); transform-style: preserve-3d; transition: transform .35s; background: none;
}
.carte-memory span { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 14px; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.carte-memory .dos { color: #fff; font-weight: 700; font-size: 24px; background: linear-gradient(135deg, var(--accent), #7c3aed); box-shadow: var(--ombre); }
.carte-memory .face { background: var(--surface); border: 1px solid var(--bord); transform: rotateY(180deg); }
.carte-memory.visible { transform: rotateY(180deg); }
.carte-memory.trouvee .face { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.morpion { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 300px); }
.morpion button {
  aspect-ratio: 1; font-size: clamp(32px, 10vw, 48px); border: 1px solid var(--bord); border-radius: 14px;
  background: var(--surface); cursor: pointer; box-shadow: var(--ombre);
}
.morpion button:not(:disabled):hover { border-color: var(--accent); }
.morpion button:disabled { cursor: default; color: inherit; }
.morpion button.gagnante { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); border-color: var(--ok); }
@media (prefers-reduced-motion: reduce) { .carte-memory { transition: none; } }
/* Badges : une couleur par rareté */
.commun { --r: #64748b; } .rare { --r: #2563eb; } .epique { --r: #9333ea; } .legendaire { --r: #f59e0b; }
.vitrine { display: inline-flex; gap: 3px; vertical-align: middle; }
.mini-badge {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; line-height: 1;
  background: color-mix(in srgb, var(--r) 16%, var(--surface)); box-shadow: 0 0 0 1.5px var(--r);
}
.mini-badge.legendaire { background: linear-gradient(135deg, #fde68a, #f59e0b); }
.tech .vitrine { margin-top: -4px; }

.resume-badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.carte.stat { margin: 0; display: grid; gap: 2px; }
.stat .valeur { font-size: 1.6rem; font-weight: 700; }
.stat .valeur small { font-size: .9rem; color: var(--muted); }

.grille-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.badge-carte {
  position: relative; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 18px 14px 14px;
  background: var(--surface); border: 1px solid var(--bord); border-top: 4px solid var(--r); border-radius: var(--rayon);
  box-shadow: var(--ombre); font-weight: 400; cursor: default;
}
.badge-carte.obtenu { cursor: pointer; }
.badge-carte.obtenu:has(input:checked) { box-shadow: 0 0 0 2px var(--r), var(--ombre); }
.badge-carte.verrouille { opacity: .6; }
.badge-carte.verrouille .badge-emoji { filter: grayscale(1); }
.badge-carte input { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; accent-color: var(--r); }
.badge-emoji {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 28px;
  background: color-mix(in srgb, var(--r) 14%, transparent);
}
.legendaire.obtenu .badge-emoji, .toast-badge.legendaire .badge-emoji { background: linear-gradient(135deg, #fde68a, #f59e0b); box-shadow: 0 0 18px rgb(245 158 11 / .5); }
.rarete { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--r); }
.quete { font-size: 13px; color: var(--muted); }
.progression { width: 100%; height: 6px; border-radius: 99px; background: var(--fond); overflow: hidden; }
.progression span { display: block; height: 100%; background: var(--r); border-radius: 99px; }
.moi-classement td, li.moi-classement { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tous-badges span { font-size: 18px; margin-right: 2px; }

/* Notification de nouveau badge */
.toast-badge {
  display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 12px 16px; color: var(--texte);
  background: var(--surface); border: 1px solid var(--bord); border-left: 5px solid var(--r); border-radius: var(--rayon);
  box-shadow: var(--ombre); animation: arrivee .4s ease-out;
}
.toast-badge > span:last-child { display: grid; }
.toast-badge small { color: var(--r); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }

/* Classements des jeux */
.carte.classement-jeux { width: min(100%, 400px); margin: 6px 0 0; }
.classement-jeux h2 { margin: 0 0 8px; font-size: 1rem; }
.podium { list-style: none; margin: 0; padding: 0; }
.podium li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.podium li strong { margin-left: auto; }
.rang-podium { width: 26px; text-align: center; }
/* Visionneuse photo */
.galerie a img { cursor: zoom-in; }
.visionneuse { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; background: rgb(5 8 18 / .96); backdrop-filter: blur(6px); }
.visionneuse[hidden] { display: none; }
.visionneuse img {
  max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 8px; user-select: none;
  touch-action: none; transition: transform .08s ease-out; box-shadow: 0 20px 60px rgb(0 0 0 / .5);
}
.vis-barre {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 99px; background: rgb(20 26 46 / .85); color: #fff; backdrop-filter: blur(8px);
}
.vis-barre button, .vis-barre a {
  width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: none; color: #fff; font-size: 20px; text-decoration: none;
}
.vis-barre button:hover, .vis-barre a:hover { background: rgb(255 255 255 / .15); }
.vis-zoom { min-width: 54px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.vis-compte { font-size: 13px; opacity: .75; padding: 0 6px; }
.vis-compte:empty { display: none; }
.vis-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border: 0; border-radius: 50%;
  background: rgb(20 26 46 / .7); color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
}
.vis-nav:hover { background: rgb(20 26 46 / .95); }
.vis-nav.prec { left: 16px; }
.vis-nav.suiv { right: 16px; }
.vis-nav[hidden] { display: none; }

/* Profils */
.lien-profil { color: inherit; }
.lien-profil:hover { color: var(--accent); text-decoration: underline; }
.carte.profil-tete { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profil-tete h1 { margin: 0; }
.profil-tete .btn.appel { margin-left: auto; }
.profil-infos { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; }
.grand-avatar { width: 72px; height: 72px; font-size: 26px; }
.special { --r: #ea580c; }
.mini-badge.special, .special.obtenu .badge-emoji { background: linear-gradient(135deg, #fdba74, #ea580c); }
/* Liste des procédures : sections par catégorie, une ligne par procédure */
.groupe-procs { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); margin-bottom: 14px; overflow: hidden; }
.groupe-procs > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; cursor: pointer; list-style: none;
  font-weight: 700; color: var(--texte); background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.groupe-procs > summary::-webkit-details-marker { display: none; }
.groupe-procs > summary::before { content: "▸"; color: var(--accent); transition: transform .15s; }
.groupe-procs[open] > summary::before { transform: rotate(90deg); }
.groupe-procs[open] > summary { border-bottom: 1px solid var(--bord); }
.compte-groupe { margin-left: auto; min-width: 26px; padding: 1px 9px; border-radius: 99px; text-align: center; font-size: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.groupe-nouveautes { border-color: color-mix(in srgb, #16a34a 50%, var(--bord)); }
.groupe-nouveautes > summary { background: color-mix(in srgb, #16a34a 10%, var(--surface)); }
.groupe-nouveautes .compte-groupe { color: #16a34a; background: color-mix(in srgb, #16a34a 16%, transparent); }
.lignes-procs { list-style: none; margin: 0; padding: 0; }
.lignes-procs li + li { border-top: 1px solid var(--bord); }
.ligne-proc { display: flex; align-items: center; gap: 16px; padding: 11px 18px; color: var(--texte); transition: background .12s; }
.ligne-proc:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.ligne-proc:hover .titre-ligne { color: var(--accent); }
.titre-ligne { flex: 1; min-width: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-ligne { display: grid; grid-template-columns: 170px 46px 82px; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); flex: none; }
.auteur-ligne { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-ligne { text-align: right; font-variant-numeric: tabular-nums; }
.etiquette-ligne { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px; color: #fff; }
.etiquette-ligne.maj { background: #2563eb; }
@media (max-width: 700px) {
  .ligne-proc { flex-direction: column; align-items: stretch; gap: 4px; }
  .meta-ligne { grid-template-columns: 1fr auto auto; }
}

/* Étiquettes « Nouvelle » / « Mise à jour » sur les cartes de procédures */
.carte.lien { position: relative; }
.carte.lien.nouvelle { border-color: color-mix(in srgb, #16a34a 55%, var(--bord)); }
.etiquette {
  position: absolute; top: -9px; right: 12px; padding: 2px 10px; border-radius: 99px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: #fff; box-shadow: var(--ombre);
}
.etiquette.nouvelle { background: linear-gradient(135deg, #22c55e, #16a34a); animation: pulse-nouvelle 2s ease-in-out 3; }
.etiquette.maj { background: linear-gradient(135deg, #38bdf8, #2563eb); }
@keyframes pulse-nouvelle { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .etiquette.nouvelle { animation: none; } }
/* Contenu : barre d'outils de mise en forme, aperçu et rendu */
.champ-contenu { display: grid; gap: 6px; }
.titre-champ { font-weight: 500; font-size: 14px; }
.barre-outils {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 5px; margin-bottom: -2px;
  background: var(--fond); border: 1px solid var(--bord); border-radius: 10px;
}
.barre-outils button {
  min-width: 34px; height: 32px; padding: 0 9px; font: inherit; font-size: 14px; color: var(--texte);
  background: var(--surface); border: 1px solid var(--bord); border-radius: 7px; cursor: pointer;
}
.barre-outils button:hover { border-color: var(--accent); color: var(--accent); }
.barre-outils button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.barre-outils .separateur { width: 1px; height: 22px; background: var(--bord); margin: 0 3px; }
.apercu-contenu { padding: 14px 16px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--surface); }
.apercu-contenu:empty::before { content: "L’aperçu s’affiche ici."; color: var(--muted); }
.photo-repere { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; background: var(--fond); border: 1px solid var(--bord); }
.contenu .titre-proc { display: block; font-size: 1.15em; font-weight: 700; margin: 8px 0 2px; color: var(--accent); }
.contenu .puce { display: list-item; list-style: disc; margin-left: 1.4em; }
.contenu mark { background: #fde047; color: #0f172a; padding: 0 3px; border-radius: 3px; }
.auteur-carte { display: block; font-size: 13px; font-weight: 500; color: var(--texte); opacity: .8; margin-bottom: 2px; }
fieldset.auteur-proc { align-items: start; border: 1px dashed var(--bord); border-radius: 10px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
fieldset.auteur-proc legend { font-weight: 500; font-size: 14px; padding: 0 6px; }
.proc-entete { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.proc-entete .btn { margin-left: auto; }
/* Historique (panneau admin) */
.colonnes-journal { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.colonnes-journal .carte { margin: 0; }
.colonnes-journal h2 { margin: 0 0 10px; font-size: 1.05rem; }
.journal { list-style: none; margin: 0; padding: 0; }
.journal li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--bord); font-size: 14px; line-height: 1.45; }
.journal li:first-child { border-top: 0; }
.icone-journal { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--fond); }
.quand-journal { display: block; font-size: 12px; color: var(--muted); }
.cible-disparue { color: var(--muted); }
/* ---------- Jeu Collection ---------- */
.entete-collection { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.compteurs-collection { display: flex; gap: 8px; flex-wrap: wrap; }
.compteur { padding: 6px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--bord); box-shadow: var(--ombre); font-size: 14px; }
.onglets-collection { grid-template-columns: repeat(4, 1fr); max-width: 640px; margin: 4px 0 18px; }
.titre-type { display: flex; align-items: center; gap: 8px; }
.mini-illu svg { width: 26px; height: 26px; color: var(--accent); vertical-align: middle; }

/* Carte */
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.commune { --rc: #94a3b8; } .peu_commune { --rc: #22c55e; } .rare { --rc: #3b82f6; } .epique { --rc: #a855f7; } .legendaire { --rc: #f59e0b; }
.carte-jeu {
  position: relative; display: grid; grid-template-rows: auto 1fr auto auto auto; justify-items: center; gap: 3px; text-align: center;
  aspect-ratio: 5 / 7; padding: 8px 8px 7px; border-radius: 14px; overflow: hidden; isolation: isolate;
  background: linear-gradient(160deg, hsl(var(--teinte, 230) 60% 96%), var(--surface) 55%);
  border: 3px solid var(--rc, var(--bord)); box-shadow: 0 6px 16px rgb(15 23 42 / .12);
  transition: transform .2s;
}
@media (prefers-color-scheme: dark) { .carte-jeu { background: linear-gradient(160deg, hsl(var(--teinte, 230) 40% 22%), var(--surface) 60%); } }
.grille-cartes .carte-jeu:not(.manquante):hover { transform: translateY(-4px) rotate(-1deg); }
.marque-carte {
  width: 100%; padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: #fff; background: hsl(var(--teinte, 230) 55% 45%);
}
.illustration-carte {
  width: 100%; min-height: 0; display: grid; place-items: center; padding: 6px; border-radius: 9px;
  color: hsl(var(--teinte, 230) 45% 38%); background: radial-gradient(circle at 50% 40%, rgb(255 255 255 / .9), hsl(var(--teinte, 230) 50% 90%) 75%);
}
@media (prefers-color-scheme: dark) { .illustration-carte { color: hsl(var(--teinte, 230) 70% 80%); background: radial-gradient(circle at 50% 40%, hsl(var(--teinte, 230) 30% 32%), hsl(var(--teinte, 230) 35% 16%) 75%); } }
.illustration-carte svg { width: 78%; max-height: 100%; filter: drop-shadow(0 3px 4px rgb(0 0 0 / .15)); }
.illustration-carte img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.avec-photo .illustration-carte { background: #fff; padding: 3px; }
.nom-carte { font-size: 13px; line-height: 1.2; }
.type-carte { font-size: 10.5px; color: var(--muted); }
.rarete-carte { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--rc); }
.quantite-carte { position: absolute; top: 32px; right: 8px; z-index: 2; padding: 1px 7px; border-radius: 99px; font-size: 12px; font-weight: 800; color: #fff; background: var(--rc); }
.nouvelle-carte { position: absolute; top: 32px; left: 8px; z-index: 2; padding: 1px 7px; border-radius: 99px; font-size: 10px; font-weight: 800; color: #fff; background: #16a34a; text-transform: uppercase; }
.carte-jeu.manquante { filter: grayscale(1); opacity: .4; border-style: dashed; }
.carte-jeu.manquante .illustration-carte > * { filter: blur(2px) brightness(.7); }
.pieces-gagnees { --rc: #eab308; --teinte: 48; }
.piece-or {
  font-size: 34px; font-weight: 900; color: #a16207;
  background: radial-gradient(circle, #fef08a 0 38%, #facc15 39% 46%, #fef9c3 47%) !important;
}
/* Reflet sur les rares et plus ; arc-en-ciel holographique sur les légendaires */
.carte-jeu.rare::after, .carte-jeu.epique::after, .carte-jeu.legendaire::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / .55) 48%, transparent 60%) no-repeat;
  background-size: 250% 100%; background-position: 150% 0; animation: reflet 3.5s ease-in-out infinite;
}
.carte-jeu.legendaire::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: color-dodge; opacity: .35;
  background: linear-gradient(125deg, #ff0080, #ffd000, #00ffa2, #00b3ff, #a200ff, #ff0080); background-size: 300% 300%;
  animation: holo 6s linear infinite;
}
.carte-jeu.epique { box-shadow: 0 0 16px rgb(168 85 247 / .4); }
.carte-jeu.legendaire { box-shadow: 0 0 0 1px #fde68a, 0 0 24px rgb(245 158 11 / .55); }
@keyframes reflet { 0%, 55% { background-position: 150% 0; } 100% { background-position: -60% 0; } }
@keyframes holo { to { background-position: 300% 300%; } }

/* Booster */
.zone-booster { display: grid; justify-items: center; gap: 12px; margin-bottom: 18px; }
.booster {
  position: relative; width: 190px; aspect-ratio: 5 / 7; border: 0; border-radius: 18px; cursor: pointer; color: #fff;
  display: grid; place-content: center; justify-items: center; gap: 6px; overflow: hidden;
  background: linear-gradient(150deg, #ef4444, #f97316 45%, #7c3aed); box-shadow: 0 14px 30px rgb(239 68 68 / .35);
  transition: transform .2s;
}
.booster::after { /* reflet qui passe sur l'emballage */
  content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, rgb(255 255 255 / .35) 50%, transparent 60%);
  background-size: 250% 100%; animation: reflet 3s ease-in-out infinite;
}
.booster:hover:not(:disabled) { transform: translateY(-6px) rotate(-2deg) scale(1.03); }
.booster:disabled:not(.secoue):not(.dechire) { filter: grayscale(.8); opacity: .55; cursor: not-allowed; }
.booster-logo { width: 74px; filter: drop-shadow(0 4px 8px rgb(0 0 0 / .3)); }
.booster-titre { font-weight: 900; font-size: 19px; letter-spacing: .05em; text-shadow: 0 2px 4px rgb(0 0 0 / .3); }
.booster-texte { font-size: 12px; opacity: .9; }
/* Déchirement : --dechire va de 0 (intact) à 1 (bande arrachée), piloté par le glissement du doigt / de la souris. */
.booster { --dechire: 0; touch-action: none; } /* glisser sur le paquet ne fait pas défiler la page */
.booster-haut {
  position: absolute; top: 0; left: 0; right: 0; height: 17%; z-index: 2;
  background: repeating-linear-gradient(90deg, rgb(255 255 255 / .18) 0 6px, transparent 6px 12px), linear-gradient(150deg, #f87171, #fb923c);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 95% 100%, 90% 78%, 85% 100%, 80% 78%, 75% 100%, 70% 78%, 65% 100%, 60% 78%, 55% 100%,
                     50% 78%, 45% 100%, 40% 78%, 35% 100%, 30% 78%, 25% 100%, 20% 78%, 15% 100%, 10% 78%, 5% 100%, 0 78%);
  transform-origin: 100% 100%;
  transform: rotate(calc(var(--dechire) * -14deg)) translate(calc(var(--dechire) * -6px), calc(var(--dechire) * -16px));
  transition: transform .08s linear;
}
.booster-pointilles { position: absolute; left: 0; right: 0; bottom: 26%; border-bottom: 2px dashed rgb(255 255 255 / .75); }
/* Lumière qui s'échappe de la déchirure, de gauche à droite */
.booster-lueur {
  position: absolute; left: 0; top: 13%; z-index: 1; height: 9px; width: calc(var(--dechire) * 100%); border-radius: 4px;
  background: linear-gradient(90deg, #fff, #fde68a); box-shadow: 0 0 18px 7px rgb(253 224 71 / .85); opacity: calc(var(--dechire) * 1.6);
}
.booster-fleche { position: absolute; top: 20%; left: 0; right: 0; z-index: 2; font-size: 11px; font-weight: 800; letter-spacing: .03em; animation: indice-glisser 1.6s ease-in-out infinite; }
.booster.entame .booster-fleche, .booster:disabled .booster-fleche { display: none; }
@keyframes indice-glisser { 50% { transform: translateX(12px); } }
.booster.arrache .booster-haut { animation: arrache .55s ease-in forwards; }
.booster.arrache .booster-lueur { width: 100%; opacity: 1; }
@keyframes arrache {
  from { transform: rotate(-14deg) translate(-6px, -16px); }
  to { transform: translate(140px, -170px) rotate(48deg); opacity: 0; }
}
.booster.secoue { animation: secoue .9s ease-in forwards; }
@keyframes secoue {
  0% { transform: none; } 15% { transform: rotate(-2deg); } 30% { transform: rotate(2deg); } 45% { transform: rotate(-4deg) scale(1.03); }
  60% { transform: rotate(4deg) scale(1.05); } 75% { transform: rotate(-6deg) scale(1.07); box-shadow: 0 0 40px rgb(253 224 71 / .8); }
  100% { transform: rotate(0) scale(1.1); box-shadow: 0 0 70px rgb(253 224 71 / .95); filter: brightness(1.35); }
}
.booster.dechire { animation: disparait .65s ease-in forwards; }
@keyframes disparait { 0% { transform: scale(1.1); filter: brightness(1.4); } 100% { transform: scale(.6) translateY(40px); opacity: 0; filter: brightness(2); } }

/* Cartes distribuées et retournées */
.tirage { width: 100%; max-width: 880px; }
.carte-jeu { color: var(--texte); } /* sinon noir dans les boutons (cartes du booster), illisible en mode sombre */
.carte-retournable {
  position: relative; aspect-ratio: 5 / 7; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1000px;
  color: inherit; font: inherit;
  animation: distribuer .6s cubic-bezier(.2, .8, .3, 1.2) backwards;
}
@keyframes distribuer { from { transform: translateY(-160px) scale(.4) rotate(-25deg); opacity: 0; } }
.carte-retournable > div { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .7s cubic-bezier(.3, .7, .3, 1.15); }
.face-cachee {
  display: grid; place-items: center; border-radius: 14px; border: 3px solid rgb(255 255 255 / .35);
  background: repeating-linear-gradient(45deg, rgb(255 255 255 / .07) 0 8px, transparent 8px 16px), linear-gradient(150deg, #ef4444, #f97316 45%, #7c3aed);
  box-shadow: var(--ombre);
}
.dos-logo { font-weight: 900; font-size: 26px; letter-spacing: .12em; color: #fff; padding: 6px 12px; border: 3px solid #fff; border-radius: 10px; text-shadow: 0 2px 4px rgb(0 0 0 / .3); }
.carte-retournable:not(.retournee):hover .face-cachee { transform: translateY(-6px) rotate(-2deg); }
/* Indice de rareté sur le dos : de plus en plus lumineux */
.indice-rare .face-cachee { box-shadow: 0 0 18px rgb(59 130 246 / .7); }
.indice-epique .face-cachee { box-shadow: 0 0 26px rgb(168 85 247 / .85); animation: pulse-dos 1.2s ease-in-out infinite; }
.indice-legendaire .face-cachee { box-shadow: 0 0 34px rgb(245 158 11 / .95); animation: pulse-dos .8s ease-in-out infinite; }
.indice-pieces .face-cachee { box-shadow: 0 0 14px rgb(250 204 21 / .6); }
@keyframes pulse-dos { 50% { filter: brightness(1.3); transform: scale(1.03); } }
.face-visible { transform: rotateY(180deg); }
.face-visible .carte-jeu { height: 100%; }
.carte-retournable.retournee { cursor: default; }
.carte-retournable.retournee .face-cachee { transform: rotateY(-180deg); }
.carte-retournable.retournee .face-visible { transform: rotateY(0); }
/* Rayons dorés derrière une légendaire révélée */
.indice-legendaire.retournee::before {
  content: ""; position: absolute; inset: -40%; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgb(253 224 71 / .55) 0 10deg, transparent 10deg 30deg);
  mask: radial-gradient(circle, #000 25%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%);
  animation: rayons 6s linear infinite;
}
.indice-epique.retournee::before {
  content: ""; position: absolute; inset: -18%; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, rgb(168 85 247 / .45), transparent 65%); animation: pulse-dos 1.6s ease-in-out infinite;
}
@keyframes rayons { to { transform: rotate(360deg); } }
.actions-tirage { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.gain-booster { font-weight: 700; min-height: 1.5em; }

/* Effets plein écran : étincelles, confettis, flash */
.effets-collection { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.etincelle { position: fixed; width: 7px; height: 7px; border-radius: 50%; margin: -3px; animation: jaillir ease-out forwards; box-shadow: 0 0 6px currentColor; }
@keyframes jaillir { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.confetti { position: fixed; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: tomber linear forwards; }
@keyframes tomber { to { transform: translate(var(--dx), 105vh) rotate(var(--tour)); } }
.flash-ecran { position: fixed; inset: 0; animation: flash .7s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .carte-retournable, .carte-retournable > div, .booster, .booster::after, .carte-jeu::after, .carte-jeu::before, .face-cachee { animation: none !important; transition: none !important; }
}
.regles-collection ul { margin: 8px 0 0; padding-left: 20px; }

/* Enchères */
.grille-encheres { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.carte.enchere { margin: 0; display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: start; }
.infos-enchere { display: grid; gap: 8px; font-size: 14px; }
.prix-enchere { font-size: 1.3rem; font-weight: 800; }
.infos-enchere input[type=number] { width: 110px; }
.form-vente select:first-of-type { flex: 2; min-width: 220px; }
.form-vente input[type=number] { width: 110px; flex: none; }
.form-carte input, .form-carte select { flex: 1; min-width: 150px; }
.progression.large { display: inline-block; width: 120px; vertical-align: middle; }

.btn.bouton-collection { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 18px; background: linear-gradient(135deg, #ef4444, #f97316 45%, #7c3aed); }
.bouton-collection small { font-weight: 500; opacity: .9; }
.classements-collection { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; align-items: start; }
.classements-collection .carte { margin: 0; }
.classements-collection h2 { margin: 0 0 4px; font-size: 1.05rem; }
.classements-collection .podium li { padding: 8px; }

/* Vue en grand d'une carte */
.carte-jeu[role="button"] { cursor: zoom-in; }
.carte-jeu[role="button"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.vue-carte { width: min(380px, calc(100% - 32px)); padding: 0; border: 0; background: none; overflow: visible; }
.vue-carte::backdrop { background: rgb(5 8 18 / .7); backdrop-filter: blur(5px); }
.vue-carte-contenu { display: grid; gap: 12px; justify-items: center; animation: arrivee-avis .25s ease-out; }
/* Grande carte retournable : recto = la carte, verso = sa description */
.carte-a-retourner {
  position: relative; width: min(300px, 78vw); aspect-ratio: 5 / 7; padding: 0; border: 0; background: none; color: var(--texte);
  font: inherit; cursor: pointer; perspective: 1200px;
}
.carte-a-retourner > div { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .7s cubic-bezier(.3, .7, .3, 1.15); }
.carte-a-retourner .verso { transform: rotateY(180deg); }
.carte-a-retourner.montre-verso .recto { transform: rotateY(-180deg); }
.carte-a-retourner.montre-verso .verso { transform: rotateY(0); }
.recto .carte-jeu { height: 100%; cursor: pointer; }
.recto .nom-carte { font-size: 19px; }
.recto .type-carte, .recto .marque-carte { font-size: 13px; }
.carte-a-retourner .verso {
  display: grid; align-content: start; justify-items: center; gap: 8px; padding: 14px; text-align: center; overflow: auto;
  border-radius: 14px; border: 3px solid var(--rc, var(--bord)); box-shadow: 0 6px 16px rgb(15 23 42 / .2);
  background: linear-gradient(200deg, hsl(var(--teinte, 230) 55% 94%), var(--surface) 60%);
}
@media (prefers-color-scheme: dark) { .carte-a-retourner .verso { background: linear-gradient(200deg, hsl(var(--teinte, 230) 40% 22%), var(--surface) 60%); } }
.verso .nom-carte { font-size: 18px; }
.verso .type-carte { font-size: 13px; }
.verso .marque-carte { font-size: 13px; }
.description-verso { margin: 6px 0 0; font-size: 14.5px; line-height: 1.55; text-align: left; }
.indice-retourner { margin: 0; color: #e2e8f0; }
@media (prefers-reduced-motion: reduce) { .carte-a-retourner > div { transition: none; } }

/* Admin : photos des cartes */
.apercu-carte-admin { display: flex; align-items: center; gap: 10px; }
.mini-carte { width: 92px; flex: none; }
.mini-carte .carte-jeu { font-size: 0; }
.mini-carte .nom-carte, .mini-carte .type-carte, .mini-carte .rarete-carte, .mini-carte .marque-carte { font-size: 8px; }
.actions-photo { display: grid; gap: 4px; }
.table-cartes tr.survol-depot td { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: 2px dashed var(--accent); }
.table-cartes tr.envoi-en-cours { opacity: .5; }
.table-cartes select { width: auto; min-width: 130px; }
.form-description { display: grid; gap: 4px; margin-top: 6px; min-width: 260px; }
.form-description textarea { font-size: 13px; padding: 6px 8px; }
.form-description .btn { justify-self: start; }
.form-carte .champ-description { flex-basis: 100%; }
/* Fenêtre d'annonce à valider */
.fenetre-avis {
  width: min(560px, calc(100% - 32px)); max-height: 85vh; padding: 0; border: 0; border-radius: 18px; overflow: auto;
  color: var(--texte); background: var(--surface); box-shadow: 0 30px 80px rgb(0 0 0 / .35); animation: arrivee-avis .3s ease-out;
}
.fenetre-avis::backdrop { background: rgb(5 8 18 / .6); backdrop-filter: blur(4px); }
#contenu-avis { display: grid; gap: 16px; padding: 24px; border-top: 6px solid var(--accent); }
.avis-entete { display: flex; gap: 14px; align-items: center; }
.avis-entete h2 { margin: 0; font-size: 1.3rem; }
.avis-entete p { margin: 2px 0 0; font-size: 13px; }
.avis-icone { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.avis-message { font-size: 15px; line-height: 1.6; }
@keyframes arrivee-avis { from { transform: translateY(20px) scale(.97); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fenetre-avis { animation: none; } }
.liste-avis li { display: grid; gap: 6px; }
.titre-section-avis { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--bord); }
.lecteurs-avis { font-size: 13px; }
.etat-email { margin-top: 12px; }
.zone-danger { margin-top: 24px; border-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.zone-danger h2 { color: var(--danger); margin-top: 0; }
.zone-danger input { max-width: 260px; }
.pied { text-align: center; padding: 0 16px 24px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.demande { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Tableau équipe */
.table { overflow-x: auto; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--bord); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tr.inactif td { opacity: .55; }

/* Jeu */
.jeu { display: grid; justify-items: center; gap: 12px; }
#jeu { width: 100%; max-width: 400px; aspect-ratio: 1; border-radius: var(--rayon); box-shadow: var(--ombre); }
.pad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: center; }
.pad .btn { justify-self: stretch; padding: 12px 0; }
.pad [data-d="ArrowUp"] { grid-area: 1 / 2; }
.pad [data-d="ArrowLeft"] { grid-area: 2 / 1; }
#rejouer { margin-top: 10px; min-width: 160px; }
.pad [data-d="ArrowRight"] { grid-area: 2 / 3; }
.pad [data-d="ArrowDown"] { grid-area: 3 / 2; }

.reset-classement { margin: 10px 0 0; text-align: right; }

/* Concours : bandeau discret en haut du contenu, et page Concours */
.bandeau-concours {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 8px 14px; border-radius: 12px;
  color: var(--texte); font-size: 14px;
  background: color-mix(in srgb, var(--couleur-concours) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--couleur-concours) 35%, var(--bord));
  transition: border-color .15s, transform .15s;
}
.bandeau-concours:hover { border-color: var(--couleur-concours); transform: translateY(-1px); }
.bandeau-concours-emoji { font-size: 18px; }
.bandeau-concours-texte { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bandeau-concours .compte { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bandeau-concours-action { font-weight: 600; color: var(--couleur-concours); white-space: nowrap; }
.concours { border-top: 4px solid var(--couleur-concours); }
.concours.termine { opacity: .85; }
.concours-tete { display: flex; align-items: center; gap: 14px; }
.concours-tete h2 { margin: 0; }
.concours-tete p { margin: 2px 0 0; }
.concours-emoji {
  flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px;
  background: color-mix(in srgb, var(--couleur-concours) 16%, transparent);
}
.concours-etat { margin-left: auto; color: var(--couleur-concours); background: color-mix(in srgb, var(--couleur-concours) 14%, transparent); }
.concours-lot { font-size: 1.05rem; }
.concours-compte { font-weight: 600; font-variant-numeric: tabular-nums; }
.concours-gagnant { font-size: 1.1rem; font-weight: 600; }
.actions-concours, .choix-gagnant { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions-concours form { margin: 0; }
.titre-section { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
.ligne-concours { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; align-items: end; }
.choix-emoji { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.choix-emoji legend { padding: 0; margin-bottom: 6px; }
.choix-emoji label { display: inline; }
.choix-emoji input { position: absolute; opacity: 0; }
.choix-emoji span { display: grid; place-items: center; width: 40px; height: 40px; font-size: 20px; border-radius: 10px; border: 1px solid var(--bord); cursor: pointer; }
.choix-emoji input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.choix-emoji input:focus-visible + span { outline: 2px solid var(--accent); }
input[type=color] { width: 64px; height: 40px; padding: 2px; }

@media (max-width: 900px) {
  nav { order: 3; flex-basis: 100%; }
}
@media (max-width: 760px) {
  .barre { position: static; gap: 8px; padding: 10px 16px; }
  .chat { height: calc(100dvh - 32px); }
  .bannieres { grid-template-columns: 1fr; margin-top: 10px; }
  /* Menu sur une ligne, qu'on fait défiler du doigt */
  nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
  nav::-webkit-scrollbar { display: none; }
  nav a { flex: none; white-space: nowrap; padding: 9px 13px; }
  .qui { gap: 6px; }
  .qui strong, .texte-deconnexion { display: none; }
  .icone-deconnexion { display: inline !important; }
  .bloc-bannieres > summary {
    display: flex; gap: 6px; align-items: center; cursor: pointer; list-style: none;
    margin: 10px 16px 0; padding: 10px 14px; border-radius: 12px; font-weight: 600;
    background: var(--surface); border: 1px solid var(--bord);
  }
  .bloc-bannieres > summary::-webkit-details-marker { display: none; }
  .bloc-bannieres > summary::after { content: '▾'; margin-left: auto; transition: transform .2s; }
  .bloc-bannieres[open] > summary::after { transform: rotate(180deg); }
  main { padding-top: 16px; }
  /* 16px : évite le zoom automatique d'iPhone sur les champs */
  input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 40px; }
  .btn.petit { min-height: 34px; }
  /* Grilles qui ne débordent plus sur petit écran */
  .grille-encheres, .colonnes-journal, .classements-collection, .grille, .tuiles-admin { grid-template-columns: minmax(0, 1fr); }
  .table-defile, table { max-width: 100%; }
  /* Collection */
  .onglets-collection, .onglets.jeux { grid-template-columns: repeat(2, 1fr); }
  .zone-booster { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .zone-booster > * { max-width: 100%; }
  /* Snake : grosses flèches */
  .pad { grid-template-columns: repeat(3, 76px); gap: 10px; }
  .pad .btn { padding: 18px 0; font-size: 20px; }
  .grille-cartes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bandeau-concours { flex-wrap: wrap; row-gap: 2px; }
  .bandeau-concours-texte { flex-basis: calc(100% - 40px); }
  .bandeau-concours .compte { flex: 1; padding-left: 28px; }
  .concours-tete { flex-wrap: wrap; }
}
/* Pas de zoom au double-tap dans les jeux */
.memory, .morpion, .pad, #jeu, .grille-cartes, .zone-booster { touch-action: manipulation; }
.icone-deconnexion { display: none; }

/* ---------- Temps réel (version Node) ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast-direct {
  display: block; padding: 12px 16px; border-radius: 12px; color: var(--texte); font-weight: 500;
  background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 10px 30px rgb(0 0 0 / .25);
  animation: toast-arrive .25s ease-out;
}
.toast-direct:hover { border-color: var(--accent-2); }
@keyframes toast-arrive { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .toast-direct { animation: none; } }
.chat-ecrit { min-height: 1.5em; margin: 0; padding: 0 16px; font-size: 13px; font-style: italic; }
