@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage-grotesque.woff2') format('woff2-variations'), url('../fonts/bricolage-grotesque.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Kufi';
  src: url('../fonts/reem-kufi-rami.woff2') format('woff2');
  font-weight: 700;
  font-display: block;
}

/*
  Sidi Bou Saïd : murs blanchis à la chaux, portes et grilles bleues, et un peu de bougainvillier.
  Le bandeau est une porte bleue (avec son arche de clous) ; les cartes sont posées à cheval sur le seuil.
*/
:root {
  --bleu: #0e5aa7;
  --bleu-fonce: #0a4683;
  --bleu-clair: #e7f0fa;
  --encre: #0d2340;
  --doux: #5b6b82;
  --chaux: #f4f7fb;
  --blanc: #ffffff;
  --trait: #dde5ef;
  --rouge: #d1344b;
  --rouge-clair: #fdecee;
  --bougainvillier: #d63a7f;

  --police: 'Bricolage', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 64px;
  --rayon: 16px;
  --ombre: 0 1px 2px rgba(13, 35, 64, .06), 0 4px 14px rgba(13, 35, 64, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--police);
  font-size: 17px;
  line-height: 1.45;
  color: var(--encre);
  background: var(--chaux);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--bleu); }
h1, h2, h3 { line-height: 1.15; margin: 0; }
h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
b, strong { font-weight: 700; }
.chiffres { font-variant-numeric: tabular-nums; }
.doux { color: var(--doux); }
.petit { font-size: 14px; }
:focus-visible { outline: 3px solid var(--bougainvillier); outline-offset: 2px; border-radius: 6px; }

#app { max-width: 560px; margin: 0 auto; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); }

/* --- Le bandeau : une porte bleue de Sidi Bou Saïd --- */
.bandeau {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: var(--bleu);
  padding: calc(18px + env(safe-area-inset-top)) 20px 26px;
  border-radius: 0 0 28px 28px;
}
.bandeau.avec-cartes { padding-bottom: 76px; }
.bandeau .mur { position: relative; z-index: 1; max-width: calc(100% - 104px); }
.bandeau .marque {
  display: inline-flex; align-items: center; gap: 8px;
  color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 650; font-size: 15px;
}
.bandeau .marque .ar { font-family: 'Kufi', sans-serif; font-weight: 700; font-size: 22px; line-height: 1; color: #fff; }
.bandeau h1 { margin-top: 6px; }
.bandeau .sous-titre { margin-top: 6px; color: rgba(255, 255, 255, .82); font-size: 15px; }
/* L'arche de clous, comme sur les portes du village. */
.bandeau .porte {
  position: absolute; right: 14px; top: calc(12px + env(safe-area-inset-top)); width: 100px; height: auto;
  fill: #fff; opacity: .2; pointer-events: none;
}

.section { padding: 22px 18px 0; }
.section > * + * { margin-top: 12px; }
.feuille {
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 18px;
}
.feuille > * + * { margin-top: 12px; }
.rangee { display: flex; align-items: center; gap: 10px; }
.rangee.entre { justify-content: space-between; }
.pile > * + * { margin-top: 10px; }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1.5px solid var(--trait);
  background: var(--blanc); color: var(--bleu);
  font-weight: 650; font-size: 17px; text-decoration: none; cursor: pointer;
}
.btn.principal { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.btn.plein { width: 100%; }
.btn.danger { color: var(--rouge); border-color: #f1c4cb; }
.btn.discret { border-color: transparent; background: transparent; padding: 0 10px; min-height: 40px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }

/* --- Cartes à jouer : un joueur = une carte --- */
.tapis { position: relative; z-index: 2; margin-top: -60px; padding: 0 18px; }
.jeu { display: grid; gap: 10px; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
.jeu.compact { gap: 8px; margin-top: 12px; }
.carte {
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 12px;
  background: var(--blanc);
  color: var(--encre);
  border: 1px solid var(--trait);
  box-shadow: 0 2px 4px rgba(13, 35, 64, .06), 0 10px 24px rgba(13, 35, 64, .12);
  display: grid; place-items: center;
  padding: 30px 7px 10px;
  text-align: center;
  perspective: 600px;
  transform: var(--pose, none);
}
.carte .coin { position: absolute; top: 8px; left: 9px; display: grid; justify-items: center; line-height: 1; }
.carte .rang { font-size: 17px; font-weight: 800; color: var(--bleu); }
.carte .couleur { width: 11px; height: 11px; margin-top: 3px; }
.carte .total { font-size: clamp(22px, 7.4vw, 34px); font-weight: 800; font-stretch: 80%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.carte .nom { font-size: 14px; font-weight: 650; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.carte .reste { font-size: 12px; color: var(--doux); margin-top: 2px; font-variant-numeric: tabular-nums; }
.carte .jauge { height: 4px; border-radius: 2px; background: var(--bleu-clair); margin-top: 7px; overflow: hidden; width: 100%; }
.carte .jauge i { display: block; height: 100%; background: var(--bleu); border-radius: 2px; }
.carte.danger .total, .carte.danger .reste { color: var(--rouge); }
.carte.danger .jauge i { background: var(--rouge); }
.carte .milieu { width: 100%; }
.compact .carte { aspect-ratio: auto; padding: 26px 5px 10px; border-radius: 10px; box-shadow: 0 1px 2px rgba(13, 35, 64, .06), 0 6px 14px rgba(13, 35, 64, .1); }
.compact .carte .total { font-size: clamp(19px, 6vw, 26px); }
.compact .carte .nom { font-size: 12px; }
.compact .carte .rang { font-size: 14px; }
.compact .carte .couleur { width: 9px; height: 9px; }
.compact .carte .reste { display: none; }
.compact .carte .jauge { height: 3px; margin-top: 5px; }

/* Joueur sorti : la carte est retournée, dos bleu à croisillons comme une grille de fenêtre. */
.carte.sortie {
  padding: 8px 6px;
  color: #fff;
  background-color: var(--bleu);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .22) 0 1.5px, transparent 1.5px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .22) 0 1.5px, transparent 1.5px 9px);
  border: 4px solid var(--blanc);
  outline: 1px solid var(--trait);
}
.carte.sortie .etiquette { background: var(--blanc); color: var(--encre); border-radius: 7px; padding: 5px 6px; width: 100%; }
.carte.sortie .total { font-size: clamp(17px, 5.5vw, 22px); }
.carte.sortie .nom { margin-top: 0; }
.carte.sortie .reste { color: var(--rouge); font-weight: 650; }

/* Sortie : la carte tremble, puis se retourne. */
.carte.vient-de-sortir { animation: retourne 1.1s cubic-bezier(.3, .7, .2, 1) both; }
@keyframes retourne {
  0% { transform: var(--pose); background: var(--blanc); border-color: transparent; }
  6% { transform: var(--pose) translateX(-6px) rotate(-4deg); background: var(--blanc); border-color: transparent; }
  12% { transform: var(--pose) translateX(6px) rotate(4deg); background: var(--blanc); border-color: transparent; }
  18% { transform: var(--pose) translateX(-4px) rotate(-2deg); background: var(--blanc); border-color: transparent; }
  26% { transform: var(--pose); background: var(--blanc); border-color: transparent; }
  62% { transform: var(--pose) rotateY(90deg); background: var(--blanc); border-color: transparent; }
  63% { transform: var(--pose) rotateY(90deg); }
  100% { transform: var(--pose) rotateY(0deg); }
}

/* Début de partie : les cartes sont distribuées depuis le centre. */
.jeu.distribue .carte { animation: distribue .6s cubic-bezier(.2, .9, .25, 1) both; animation-delay: calc(var(--i) * 110ms + 120ms); }
@keyframes distribue {
  from { opacity: 0; transform: translate(var(--dx), -150px) rotate(-28deg) scale(.7); }
  55% { opacity: 1; }
  to { opacity: 1; transform: var(--pose); }
}

/* Le gagnant. */
.carte.gagnante { border-color: var(--bougainvillier); box-shadow: 0 0 0 2px var(--bougainvillier), 0 10px 28px rgba(214, 58, 127, .3); }
.carte.vient-de-gagner { animation: sacre 1.4s cubic-bezier(.2, .9, .3, 1.2) both; z-index: 1; }
@keyframes sacre {
  0% { transform: var(--pose); }
  35% { transform: translateY(-16px) scale(1.12) rotate(0deg); }
  100% { transform: var(--pose); }
}

/* Taxiphone : le combiné sur la carte. */
.carte .taxi {
  position: absolute; top: -8px; right: -8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 2px; padding: 3px 7px 3px 5px;
  border-radius: 12px; background: var(--encre); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 1;
  box-shadow: 0 2px 6px rgba(13, 35, 64, .3);
}
.carte .taxi .combine { width: 12px; height: 12px; }
.carte .taxi.sonne .combine { animation: sonne .22s ease-in-out 10; }
.compact .carte .taxi { top: -6px; right: -6px; padding: 2px 6px 2px 4px; font-size: 11px; }
@keyframes sonne { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); } }

/* --- Une table sur l'accueil --- */
.table-bloc {
  display: block; text-decoration: none; color: inherit;
  background: var(--bleu-clair); border-radius: var(--rayon); padding: 16px 14px 18px;
}
.table-bloc .statut { font-size: 14px; color: var(--doux); text-align: right; }

/* --- Saisie d'une manche --- */
.saisie { display: grid; grid-template-columns: minmax(0, 1fr) 82px auto auto; gap: 8px 6px; align-items: center; }
.saisie label { font-weight: 650; display: flex; align-items: center; gap: 8px; min-width: 0; }
.saisie label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saisie .couleur { width: 14px; height: 14px; flex: none; }
.saisie input {
  width: 100%; height: 52px; padding: 0 12px;
  border: 1.5px solid var(--trait); border-radius: 12px; background: var(--chaux);
  font-size: 24px; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums;
}
.saisie input:focus { border-color: var(--bleu); background: #fff; outline: none; box-shadow: 0 0 0 4px rgba(14, 90, 167, .14); }
.saisie input.ferme { color: var(--bleu); background: var(--bleu-clair); border-color: #b9d0ea; }
.saisie input.rien { color: var(--rouge); background: var(--rouge-clair); border-color: #f1c4cb; }
.saisie .mode { min-height: 52px; padding: 0 10px; font-size: 15px; }
.saisie .mode[aria-pressed="true"] { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.saisie .mode[data-action="rien"] { color: var(--rouge); }
.saisie .mode[data-action="rien"][aria-pressed="true"] { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.apercu { font-size: 15px; color: var(--doux); min-height: 22px; }
.apercu strong { color: var(--rouge); font-weight: 650; }
.apercu .taxi-texte { color: var(--encre); }

/* --- Tableau des manches --- */
.defile { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.manches { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 16px; }
table.manches th, table.manches td { padding: 9px 6px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--trait); }
table.manches th:first-child, table.manches td:first-child { text-align: left; color: var(--doux); width: 1%; }
table.manches thead th { font-weight: 700; font-size: 14px; color: var(--doux); }
table.manches thead th .couleur { width: 10px; height: 10px; vertical-align: -1px; margin-right: 3px; }
table.manches tbody tr { cursor: pointer; }
table.manches tbody tr:hover td { background: var(--chaux); }
table.manches td.sort { color: var(--rouge); font-weight: 800; }
table.manches td.vide { color: var(--trait); }
table.manches td.gagne { color: var(--bleu); font-weight: 700; }
table.manches .entoure { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--rouge-clair); color: var(--rouge); font-weight: 700; }
table.manches tfoot td { font-weight: 800; font-size: 18px; border-bottom: 0; }
table.manches tr.edite td { background: var(--bleu-clair); }

/* --- Résultats --- */
ol.resultats { list-style: none; margin: 0; padding: 0; }
ol.resultats li { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--trait); }
ol.resultats li:last-child { border-bottom: 0; }
ol.resultats .place { font-weight: 800; font-size: 22px; color: var(--bleu); }
ol.resultats .gain { font-weight: 750; color: var(--bleu); font-variant-numeric: tabular-nums; }
ol.resultats .tot { color: var(--doux); font-size: 14px; font-variant-numeric: tabular-nums; }

/* --- Classement --- */
.classement { list-style: none; margin: 0; padding: 0; }
.classement li { display: grid; grid-template-columns: 36px 1fr auto; gap: 4px 10px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--trait); }
.classement li:last-child { border-bottom: 0; }
.classement .rang { font-size: 22px; font-weight: 800; text-align: center; color: var(--doux); font-variant-numeric: tabular-nums; }
.classement .qui { font-weight: 700; font-size: 18px; }
.classement .pts { font-size: 28px; font-weight: 800; font-stretch: 80%; text-align: right; line-height: 1; font-variant-numeric: tabular-nums; }
.classement .pts small { font-size: 13px; font-weight: 500; color: var(--doux); font-stretch: 100%; margin-left: 3px; }
.classement .stats { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--doux); font-variant-numeric: tabular-nums; }
.classement li.tete .rang, .classement li.tete .pts { color: var(--bleu); }
.forme { display: inline-flex; gap: 3px; vertical-align: middle; }
.forme b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 12px; font-weight: 750; }
.forme b.t1 { background: var(--bleu); color: #fff; }
.forme b.t2 { box-shadow: inset 0 0 0 1.5px var(--bleu); color: var(--bleu); }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--doux); }
.legende .forme b { width: 16px; height: 16px; }

/* --- Nouveau tour --- */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 22px; border: 1.5px solid var(--trait); background: var(--blanc);
  font-weight: 650; cursor: pointer; color: var(--encre);
}
.puce[aria-pressed="true"] { border-color: var(--bleu); background: var(--bleu-clair); color: var(--bleu); }
.puce.choisie { border-color: var(--bougainvillier); box-shadow: 0 0 0 3px rgba(214, 58, 127, .2); }
.puce .mvt { font-size: 13px; font-weight: 700; }
.puce .mvt.monte { color: var(--bleu); }
.puce .mvt.descend { color: var(--rouge); }
.table-choix { border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px; background: var(--blanc); }
.table-choix > * + * { margin-top: 10px; }
.table-choix.t1 { border: 2px solid var(--bleu); }

/* --- Réglages --- */
.champ { display: grid; gap: 6px; }
.champ label { font-weight: 650; }
.champ input[type="text"], .champ input[type="number"], .champ input[type="password"], .champ input:not([type]) {
  height: 48px; padding: 0 14px; border: 1.5px solid var(--trait); border-radius: 12px; background: var(--chaux); font-size: 17px; width: 100%;
}
.champ input:focus { border-color: var(--bleu); background: #fff; outline: none; }
.champ .aide { font-size: 14px; color: var(--doux); }
.joueurs-liste { list-style: none; margin: 0; padding: 0; }
.joueurs-liste li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--trait); }
.joueurs-liste li:last-child { border-bottom: 0; }
.joueurs-liste .nom { flex: 1; font-weight: 650; }
.joueurs-liste li.inactif .nom { color: var(--doux); text-decoration: line-through; }
.interrupteur { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--doux); }
.interrupteur input { width: 22px; height: 22px; accent-color: var(--bleu); }

/* --- Historique --- */
.tour-histo > * + * { margin-top: 8px; }
.ligne-partie { display: block; text-decoration: none; color: inherit; padding: 11px 0; border-top: 1px solid var(--trait); }
.ligne-partie .noms { font-size: 15px; }
.ligne-partie .noms b { font-weight: 700; }

/* --- Journal des modifications --- */
details.journal > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details.journal > summary::-webkit-details-marker { display: none; }
details.journal > summary::after {
  content: ''; flex: none; width: 10px; height: 10px; margin-right: 4px;
  border-right: 2px solid var(--doux); border-bottom: 2px solid var(--doux);
  transform: rotate(45deg); transition: transform .15s;
}
details.journal[open] > summary::after { transform: rotate(-135deg); }
details.journal > summary .titre { display: grid; gap: 2px; }
ol.journal-liste { list-style: none; margin: 0; padding: 0; }
ol.journal-liste li { padding: 12px 0 12px 16px; border-left: 2px solid var(--trait); position: relative; }
ol.journal-liste li::before {
  content: ''; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--blanc); border: 2px solid var(--bleu);
}
ol.journal-liste li:first-child::before { background: var(--bleu); }
ol.journal-liste li > * + * { margin-top: 3px; }
ol.journal-liste .detail { font-size: 15px; font-variant-numeric: tabular-nums; }
ol.journal-liste .detail b { color: var(--bleu); }
ol.journal-liste .meta { font-size: 13px; color: var(--doux); }
ol.journal-liste .retablir { min-height: 40px; margin-top: 8px; font-size: 15px; }
.signature { font-size: 14px; color: var(--doux); }
.lien { border: 0; background: none; padding: 0; color: var(--bleu); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* --- Navigation --- */
nav.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--trait);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.onglets ul { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; display: grid; grid-template-columns: repeat(4, 1fr); }
nav.onglets a {
  position: relative; display: grid; place-items: center; gap: 2px; height: var(--nav-h);
  text-decoration: none; color: var(--doux); font-size: 13px; font-weight: 600;
}
nav.onglets svg { width: 24px; height: 24px; }
nav.onglets a[aria-current="page"] { color: var(--bleu); }
nav.onglets a[aria-current="page"]::before {
  content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--bleu);
}
nav.onglets a[aria-current="page"] svg { stroke-width: 2.3; }

/* --- Messages --- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); z-index: 20;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--encre); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; font-weight: 600;
  box-shadow: 0 10px 26px rgba(13, 35, 64, .3);
}
.toast.erreur { background: var(--rouge); }
.vide-etat > * + * { margin-top: 12px; }
.alerte { background: var(--rouge-clair); color: var(--rouge); border-radius: 12px; padding: 11px 14px; font-size: 15px; }

dialog { border: 0; border-radius: 20px; padding: 22px; width: min(360px, calc(100% - 32px)); color: var(--encre); background: var(--blanc); box-shadow: 0 24px 60px rgba(13, 35, 64, .3); }
dialog::backdrop { background: rgba(13, 35, 64, .45); }
dialog form > * + * { margin-top: 12px; }

.chargement { padding: 40px 18px; color: var(--doux); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font-size: .9em; background: var(--bleu-clair); padding: 1px 6px; border-radius: 5px; }

/* --- Annonces : un joueur sort, un taxiphone sonne --- */
.annonce {
  position: fixed; z-index: 30; left: 50%; top: calc(12px + env(safe-area-inset-top));
  width: min(420px, calc(100% - 24px));
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  border-radius: 16px; background: var(--blanc); color: var(--encre);
  box-shadow: 0 16px 36px rgba(13, 35, 64, .25);
  transform: translate(-50%, -150%);
  animation: descend .45s cubic-bezier(.2, .9, .3, 1.25) forwards;
}
.annonce.part { animation: remonte .35s ease-in forwards; }
.annonce b { display: block; font-size: 18px; font-weight: 800; line-height: 1.2; }
.annonce span { font-size: 14px; color: var(--doux); }
.annonce .dos {
  flex: none; width: 28px; height: 38px; border-radius: 5px; border: 3px solid var(--blanc); outline: 1px solid var(--trait);
  background-color: var(--bleu);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .3) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(255, 255, 255, .3) 0 1px, transparent 1px 5px);
  transform: rotate(-8deg);
}
.annonce.taxiphone { background: var(--encre); color: #fff; }
.annonce.taxiphone span { color: rgba(255, 255, 255, .75); }
.annonce .combine { flex: none; width: 32px; height: 32px; transform-origin: 50% 60%; animation: sonne .22s ease-in-out 9 .2s; }
@keyframes descend { to { transform: translate(-50%, 0); } }
@keyframes remonte { from { transform: translate(-50%, 0); } to { transform: translate(-50%, -150%); opacity: 0; } }

/* --- Fin de partie : « Mabrouk » --- */
.fete {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px;
  background: rgba(10, 70, 131, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: apparait .3s ease-out both;
}
.fete.part { animation: disparait .25s ease-in forwards; }
.fete-carte {
  position: relative; width: min(340px, 100%); padding: 26px 22px 22px; text-align: center;
  background: var(--blanc); color: var(--encre); border-radius: 24px;
  box-shadow: 0 30px 70px rgba(13, 35, 64, .4);
  animation: pose .6s cubic-bezier(.2, .9, .3, 1.3) .1s both;
}
.fete-carte .ar { font-family: 'Kufi', sans-serif; font-weight: 700; font-size: 46px; line-height: 1.2; color: var(--bleu); }
.fete-carte h2 { font-size: 26px; margin-top: 4px; }
.fete-carte p { margin-top: 6px; color: var(--doux); }
.fete-carte .gain { font-weight: 800; color: var(--bougainvillier); font-size: 24px; margin: 12px 0 18px; }
.pluie { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.pluie span {
  position: absolute; top: -40px; left: var(--x);
  width: calc(24px * var(--s)); height: calc(24px * var(--s));
  animation: tombe var(--t) linear var(--d) infinite;
}
.pluie svg { width: 100%; height: 100%; }
@keyframes tombe { from { transform: translateY(0) rotate(0); } to { transform: translateY(calc(100vh + 80px)) rotate(var(--r)); } }
@keyframes pose { from { opacity: 0; transform: translateY(40px) scale(.85) rotate(-5deg); } to { opacity: 1; transform: none; } }
@keyframes apparait { from { opacity: 0; } }
@keyframes disparait { to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .pluie { display: none; }
  .carte.vient-de-sortir, .carte.vient-de-gagner, .jeu.distribue .carte, .fete, .fete-carte,
  .annonce .combine, .carte .taxi.sonne .combine { animation: none !important; }
  .annonce, .annonce.part { animation: none; transform: translate(-50%, 0); }
}
