/* ============================================================
   UnoPrivé — feuille de style principale (mobile-first)
   De 360 px jusqu'au desktop large. Transform3d/will-change pour
   le confort 60 fps ; les animations d'ambiance arrivent en S6.
   ============================================================ */

:root {
  --rouge: #d7263d;
  --jaune: #f7b801;
  --vert: #2f9e44;
  --bleu: #2266cc;
  --fond: #0b1220;
  --feutre: #0b3d2e;
  --feutre-clair: #14553f;
  --panneau: #101d2e;
  --panneau-clair: #1a2c42;
  --texte: #f1f5f9;
  --texte-sombre: #94a3b8;
  --ligne: #243b55;
  --danger: #e11d48;
  --carte-l: 64px;   /* largeur d'une carte en main */
  --carte-h: 92px;   /* hauteur d'une carte en main */
  --ombre-carte: 0 3px 8px rgba(0, 0, 0, .45);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(120% 100% at 50% 0%, #12233a 0%, var(--fond) 60%);
  color: var(--texte);
  overscroll-behavior: none;
}

.cache { display: none !important; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font: inherit;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--ligne);
  border-radius: 10px;
  padding: .65em .8em;
  width: 100%;
}
input:focus { outline: 2px solid var(--bleu); outline-offset: 1px; }

.indice { color: var(--texte-sombre); font-size: .85rem; }
.erreur { color: #fda4af; min-height: 1.2em; margin: .4em 0 0; }

/* ================= Boutons ================= */

.btn-principal, .btn-secondaire {
  border-radius: 12px;
  padding: .8em 1.4em;
  font-weight: 700;
  transition: transform .12s ease, filter .12s ease;
  will-change: transform;
}
.btn-principal { background: var(--vert); color: #fff; box-shadow: 0 4px 14px rgba(47, 158, 68, .4); }
.btn-secondaire { background: var(--panneau-clair); color: var(--texte); border: 1px solid var(--ligne); }
.btn-principal:active, .btn-secondaire:active { transform: scale(.96); }
.btn-principal:disabled, .btn-secondaire:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-icone {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--panneau-clair);
  border: 1px solid var(--ligne);
  font-size: 1.05rem;
  position: relative;
  flex: none;
}
.btn-icone:active { transform: scale(.93); }

/* ================= Écrans ================= */

.ecran {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Accueil ---------- */

.accueil-boite {
  width: min(480px, 100% - 2rem);
  margin: auto;
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 20px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.logo {
  margin: 0;
  font-size: 2.4rem;
  font-style: italic;
  letter-spacing: -1px;
  text-align: center;
  color: var(--jaune);
  text-shadow: 3px 3px 0 var(--rouge), 6px 6px 0 rgba(0, 0, 0, .35);
}
.logo span { color: var(--texte); }

.slogan { text-align: center; color: var(--texte-sombre); margin: 0 0 .4rem; }

.reprise {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: var(--panneau-clair);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: .6rem .8rem;
}

.cartes-onglets { display: flex; gap: .5rem; }
.onglet {
  flex: 1;
  padding: .7em;
  border-radius: 12px;
  background: var(--panneau-clair);
  border: 1px solid var(--ligne);
  color: var(--texte-sombre);
  font-weight: 700;
}
.onglet.actif { background: var(--bleu); border-color: var(--bleu); color: #fff; }

.panneau-onglet { display: flex; flex-direction: column; gap: .8rem; }

.champ { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--texte-sombre); }

#presets {
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: .7rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
#presets legend { padding: 0 .4em; color: var(--texte-sombre); font-size: .85rem; }

.preset {
  display: flex; align-items: center; gap: .7rem;
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: .6rem .7rem;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.preset:hover { background: var(--panneau-clair); }
.preset.actif { border-color: var(--jaune); background: rgba(247, 184, 1, .08); }
.preset input { width: auto; accent-color: var(--jaune); }
.preset-texte { display: flex; flex-direction: column; }
.preset-texte strong { color: var(--texte); }
.preset-texte small { color: var(--texte-sombre); }

#details-options { border: 1px solid var(--ligne); border-radius: 12px; padding: .6rem .8rem; }
#details-options summary { cursor: pointer; font-weight: 600; color: var(--texte-sombre); }

#options { display: flex; flex-direction: column; gap: .35rem; margin-top: .6rem; }
.option-ligne {
  display: flex; align-items: center; gap: .6rem;
  font-size: .9rem;
  padding: .25rem 0;
  cursor: pointer;
}
.option-ligne input { width: auto; accent-color: var(--vert); }
.option-ligne .option-infos { display: flex; flex-direction: column; }
.option-ligne .option-infos small { color: var(--texte-sombre); }
.option-ligne input[type="number"] { width: 4.5em; margin-left: auto; }

/* ---------- Barre supérieure ---------- */

.barre {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .7rem;
  background: rgba(11, 18, 32, .85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--ligne);
  position: sticky; top: 0;
  z-index: 20;
}

.titre-room { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.titre-room strong { font-size: 1rem; letter-spacing: 1px; }
.titre-room span { font-size: .75rem; color: var(--texte-sombre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bandeau-tour {
  margin-left: auto;
  margin-right: auto;
  font-weight: 700;
  font-size: .9rem;
  color: var(--jaune);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pastille {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: var(--rouge);
  color: #fff;
  font-size: .7rem;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ---------- Lobby ---------- */

.lobby-corps {
  width: min(520px, 100% - 2rem);
  margin: 1.2rem auto;
  display: flex; flex-direction: column; gap: .9rem;
  flex: 1;
}

.liste-joueurs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }

.joueur-ligne {
  display: flex; align-items: center; gap: .7rem;
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: .6rem .8rem;
}
.joueur-ligne .avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: #fff;
  background: var(--bleu);
}
.joueur-ligne .infos { display: flex; flex-direction: column; min-width: 0; }
.joueur-ligne .infos strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.joueur-ligne .infos small { color: var(--texte-sombre); }
.joueur-ligne .etat { margin-left: auto; font-size: 1.1rem; }

.lobby-actions { display: flex; gap: .7rem; }
.lobby-actions .btn-principal { flex: 1; }
.lobby-actions .btn-secondaire { flex: 1; }

/* ================= JEU ================= */

#ecran-jeu { background: radial-gradient(140% 110% at 50% 30%, var(--feutre-clair) 0%, var(--feutre) 70%); }

.adversaires {
  display: flex;
  gap: .5rem;
  padding: .6rem .5rem .2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.adversaires::-webkit-scrollbar { display: none; }

.adversaire {
  flex: none;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: .4rem .55rem;
  border-radius: 14px;
  border: 2px solid transparent;
  background: rgba(0, 0, 0, .18);
  min-width: 74px;
  position: relative;
  transition: border-color .15s ease;
}
.adversaire.tour-courant { border-color: var(--jaune); box-shadow: 0 0 12px rgba(247, 184, 1, .35); }

.adversaire .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .95rem; color: #fff;
  background: var(--bleu);
}
.adversaire .nom {
  font-size: .72rem;
  max-width: 84px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.adversaire .nb-cartes {
  font-size: .72rem;
  color: var(--texte-sombre);
  display: inline-flex; align-items: center; gap: .25rem;
}
.adversaire .dos-mini {
  width: 14px; height: 20px;
  border-radius: 3px;
  background: var(--rouge);
  border: 1px solid rgba(255, 255, 255, .5);
  display: inline-block;
}

.badge-uno {
  position: absolute; top: -8px; right: -6px;
  background: var(--rouge);
  color: #fff;
  font-size: .6rem; font-weight: 800;
  padding: .15em .5em;
  border-radius: 8px;
  transform: rotate(8deg);
  animation: pulse-badge 1.2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: rotate(8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.15); }
}

.btn-attraper {
  margin-top: .15rem;
  background: var(--danger);
  color: #fff;
  font-size: .68rem; font-weight: 800;
  border-radius: 8px;
  padding: .25em .6em;
  animation: pulse-badge 1s ease-in-out infinite;
}

/* ---------- Plateau central ---------- */

.plateau {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  padding: .4rem .5rem;
  min-height: 210px;
  position: relative;
}

.pile-zone { display: flex; align-items: center; gap: 1.6rem; }

.pile { position: relative; }

.pioche {
  border-radius: 12px;
  transition: transform .12s ease;
  will-change: transform;
}
.pioche:active { transform: scale(.95); }
.pioche:disabled { opacity: .55; cursor: not-allowed; }

.pioche-nombre {
  position: absolute; bottom: -6px; left: 50%;
  transform: translateX(-50%);
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 8px;
  font-size: .68rem;
  padding: .1em .5em;
  color: var(--texte-sombre);
  white-space: nowrap;
}

.defausse { min-width: var(--carte-l); min-height: var(--carte-h); }

.plateau-infos { display: flex; align-items: center; gap: 1rem; }

.badge-couleur {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .85);
  background: var(--rouge);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  transition: background .25s ease;
}

.fleche-sens {
  font-size: 1.5rem;
  color: var(--texte);
  display: inline-block;
  transition: transform .3s ease;
  will-change: transform;
}
.fleche-sens.antihoraire { transform: rotate(180deg); }

.bandeau {
  position: absolute;
  top: .4rem; left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--ligne);
  border-radius: 999px;
  padding: .35em 1em;
  font-size: .8rem;
  white-space: nowrap;
  max-width: 96%;
  overflow: hidden; text-overflow: ellipsis;
}
.bandeau-attente { color: #fca5a5; }
.bandeau-impose { color: var(--jaune); }

/* ---------- Cartes ---------- */

.carte {
  width: var(--carte-l);
  height: var(--carte-h);
  border-radius: 10px;
  background: #f8fafc;
  color: #111;
  position: relative;
  box-shadow: var(--ombre-carte);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  display: block;
}
.carte:active { filter: brightness(.92); }

/* ellipse centrale blanche typée Uno */
.carte::before {
  content: "";
  position: absolute; inset: 14% 8%;
  border-radius: 50%;
  background: #fff;
  transform: rotate(-18deg);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .08);
}

.carte .coin {
  position: absolute; top: 4px; left: 6px;
  font-weight: 900; font-size: .95rem;
  color: #fff;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.carte .centre {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 1.6rem;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.carte .centre.petit { font-size: 1.05rem; }

.carte.c-rouge { background: var(--rouge); }
.carte.c-jaune { background: var(--jaune); }
.carte.c-vert { background: var(--vert); }
.carte.c-bleu { background: var(--bleu); }
.carte.c-joker {
  background: linear-gradient(135deg, var(--rouge) 0 25%, var(--jaune) 25% 50%, var(--vert) 50% 75%, var(--bleu) 75% 100%);
}
.carte.c-joker .centre, .carte.c-joker .coin { color: #fff; }

/* carte non jouable = assombrie */
.carte.non-jouable { filter: saturate(.45) brightness(.72); }

/* carte jouable = halo + léger soulèvement */
.carte.jouable { cursor: pointer; box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(255, 255, 255, .45), var(--ombre-carte); }
.carte.jouable:hover { transform: translateY(-8px); }

/* En main : le survol surélève la carte sans casser l'éventail (variables). */
.ma-main .carte.jouable:hover {
  transform: translateX(var(--dx, 0px)) rotate(var(--rot, 0deg)) translateY(calc(var(--dy, 0px) - 12px)) scale(1.05);
}

/* Maintien (souris ou doigt) sur une carte jouable : surbrillance de sélection. */
.ma-main .carte.jouable:active {
  transform: translateX(var(--dx, 0px)) rotate(var(--rot, 0deg)) translateY(calc(var(--dy, 0px) - 8px)) scale(1.04);
  box-shadow: 0 0 0 3px var(--jaune), 0 12px 26px rgba(0, 0, 0, .55);
}

/* ---- Glisser-déposer vers la défausse ---- */

/* Fantôme qui suit le pointeur pendant la glisse. */
.carte.glisse {
  position: fixed; z-index: 95; pointer-events: none;
  transform: translate(-50%, -50%) scale(1.15) rotate(-3deg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .55);
  touch-action: none;
}

/* La défausse pulse quand la carte la survole. */
@keyframes depot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(247, 184, 1, .35); }
  50%      { box-shadow: 0 0 0 10px rgba(247, 184, 1, .10); }
}

#zone-defausse.depot-actif {
  border-radius: 10px;
  animation: depot-pulse .8s ease-in-out infinite;
}

/* jump-in possible hors de son tour */
.carte.sautable { cursor: pointer; box-shadow: 0 0 0 2px var(--jaune), 0 0 16px rgba(247, 184, 1, .6), var(--ombre-carte); }

/* dos de carte */
.carte-dos, .carte.dos {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .16) 0 6px, transparent 6px 12px),
    var(--rouge);
  border: 3px solid #f8fafc;
}
.carte-dos::before, .carte.dos::before { display: none; }
.carte-dos::after, .carte.dos::after {
  content: "✦";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .85);
  font-size: 1.4rem;
}

/* zoom long-press */
.carte.zoom {
  position: fixed;
  z-index: 90;
  width: calc(var(--carte-l) * 2.2);
  height: calc(var(--carte-h) * 2.2);
  left: 50%; top: 40%;
  transform: translate(-50%, -50%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
  animation: zoom-pop .18s cubic-bezier(.2, .8, .3, 1.2);
}

@keyframes zoom-pop {
  from { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);  opacity: 1; }
}

/* ---------- Ma main (éventail) ---------- */

.zone-main {
  position: relative;
  padding: 0 .4rem calc(.6rem + env(safe-area-inset-bottom));
}

.ma-main {
  position: relative;
  height: calc(var(--carte-h) + 34px);
  margin: 0 auto;
  max-width: 900px;
}

.ma-main .carte {
  position: absolute;
  left: 50%; bottom: 0;
  margin-left: calc(var(--carte-l) / -2);
  transform-origin: 50% 130%;
  transform: translateX(var(--dx, 0px)) rotate(var(--rot, 0deg)) translateY(var(--dy, 0px));
  will-change: transform;
  transition: transform .18s ease, box-shadow .18s ease;
  touch-action: none; /* le doigt glisse la carte au lieu de faire défiler */
}

.actions-main {
  display: flex; align-items: center; justify-content: center; gap: .8rem;
  margin-top: .35rem;
}

/* ---------- Bouton UNO ---------- */

.btn-uno {
  background: var(--rouge);
  color: #fff;
  font-weight: 900;
  font-style: italic;
  font-size: 1.15rem;
  letter-spacing: 1px;
  padding: .55em 1.2em;
  border-radius: 999px;
  box-shadow: 0 0 0 3px #fff, 0 6px 18px rgba(215, 38, 61, .55);
  animation: pulse-uno .9s ease-in-out infinite;
  will-change: transform;
}
.btn-uno:active { transform: scale(.93); }

@keyframes pulse-uno {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ================= Chat ================= */

.tiroir {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(340px, 92vw);
  background: var(--panneau);
  border-left: 1px solid var(--ligne);
  display: flex; flex-direction: column;
  z-index: 60;
  box-shadow: -12px 0 30px rgba(0, 0, 0, .45);
  animation: glisse-gauche .18s ease;
}

@keyframes glisse-gauche {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.tiroir-entete {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--ligne);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: .7rem .8rem;
  display: flex; flex-direction: column; gap: .45rem;
}

.msg-chat { font-size: .88rem; line-height: 1.35; word-break: break-word; }
.msg-chat .expediteur { font-weight: 700; color: var(--jaune); }
.msg-chat .heure { color: var(--texte-sombre); font-size: .72rem; margin-left: .4em; }
.msg-chat.systeme { color: var(--texte-sombre); font-style: italic; font-size: .8rem; }

.chat-form {
  display: flex; gap: .4rem;
  padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ligne);
}
.chat-form input { flex: 1; }
.chat-form button {
  background: var(--vert); color: #fff;
  border-radius: 10px; padding: 0 .9em;
}

/* ================= Fin de manche ================= */

.ecran-fin {
  position: fixed; inset: 0;
  background: rgba(4, 10, 20, .78);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 70;
  padding: 1rem;
}

.boite-fin {
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 20px;
  padding: 1.6rem;
  text-align: center;
  width: min(400px, 100%);
  display: flex; flex-direction: column; gap: .8rem;
  animation: apparition .25s ease;
}

@keyframes apparition {
  from { transform: scale(.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.boite-fin h2 { margin: 0; font-size: 1.6rem; color: var(--jaune); }
.boite-fin p { margin: 0; color: var(--texte-sombre); }

.fin-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: .4rem; }

/* ================= Modale ================= */

.modale {
  position: fixed; inset: 0;
  background: rgba(4, 10, 20, .72);
  display: flex; align-items: center; justify-content: center;
  z-index: 80;
  padding: 1rem;
}

.modale-boite {
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 20px;
  padding: 1.3rem;
  width: min(420px, 100%);
  max-height: 82dvh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: .9rem;
  animation: apparition .22s ease;
}

.modale-boite h3 { margin: 0; text-align: center; }
.modale-boite p { margin: 0; color: var(--texte-sombre); text-align: center; }

/* roue de couleur */
.roue-couleurs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}
.choix-couleur {
  height: 64px;
  border-radius: 14px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  border: 3px solid rgba(255, 255, 255, .25);
  transition: transform .12s ease;
  will-change: transform;
}
.choix-couleur:active { transform: scale(.94); border-color: #fff; }
.choix-couleur.c-rouge { background: var(--rouge); }
.choix-couleur.c-jaune { background: var(--jaune); color: #3a2c00; text-shadow: none; }
.choix-couleur.c-vert { background: var(--vert); }
.choix-couleur.c-bleu { background: var(--bleu); }

/* liste de choix (cible d'échange, carte imposée…) */
.liste-choix { display: flex; flex-direction: column; gap: .45rem; }
.btn-choix {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panneau-clair);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: .6rem .8rem;
  text-align: left;
  font-weight: 600;
  transition: border-color .12s ease;
}
.btn-choix:hover { border-color: var(--jaune); }
.btn-choix .apercu { flex: none; }

/* modale règles */
.regles-liste { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.regles-liste li {
  background: var(--panneau-clair);
  border: 1px solid var(--ligne);
  border-radius: 10px;
  padding: .5rem .7rem;
  font-size: .88rem;
}
.regles-liste li.actif { border-color: var(--vert); }
.regles-liste li.inactif { opacity: .5; }
.regles-liste strong { display: block; }
.regles-liste small { color: var(--texte-sombre); }

.modale-actions { display: flex; gap: .6rem; }
.modale-actions button { flex: 1; }

/* ================= Toasts / connexion ================= */

.toasts {
  position: fixed; left: 50%; bottom: 12px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  z-index: 100;
  width: min(380px, 92vw);
  pointer-events: none;
}

.toast {
  background: var(--panneau-clair);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: .55em 1em;
  font-size: .88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  animation: toast-entre .2s ease;
  max-width: 100%;
}
.toast.erreur { border-color: var(--danger); color: #fecdd3; }
.toast.disparait { opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease; }

@keyframes toast-entre {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.bandeau-connexion {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--danger);
  color: #fff;
  text-align: center;
  font-size: .82rem;
  padding: .35em;
  z-index: 110;
  animation: pulse-badge 1.4s ease-in-out infinite;
}

/* ================= Desktop ================= */

@media (min-width: 768px) {
  :root { --carte-l: 84px; --carte-h: 120px; }

  .adversaires { justify-content: center; gap: 1.2rem; padding-top: 1rem; }
  .adversaire { min-width: 96px; padding: .6rem .8rem; }
  .adversaire .avatar { width: 44px; height: 44px; }
  .adversaire .nom { font-size: .82rem; max-width: 110px; }

  .pile-zone { gap: 2.4rem; }
  .ma-main { height: calc(var(--carte-h) + 44px); }
  .bandeau { font-size: .9rem; }

  .fin-actions { flex-direction: row; justify-content: center; }
  .fin-actions button { flex: none; min-width: 170px; }

  .lobby-actions .btn-principal, .lobby-actions .btn-secondaire { flex: none; padding-left: 2em; padding-right: 2em; }
}

@media (min-width: 1100px) {
  :root { --carte-l: 96px; --carte-h: 136px; }
  .plateau { gap: 1rem; }
}

/* Accessibilité : mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* ================= Animations de jeu (S6) ================= */
/* Toutes les animations sont transform/opacity uniquement (60 fps, GPU). */

/* Distribution : la carte arrive en vol depuis le talon, en cascade */
@keyframes deal-vol {
  from { transform: translate(28vw, -42vh) rotate(-10deg) scale(0.6); opacity: 0; }
  55% { opacity: 1; }
  to { transform: none; opacity: 1; }
}

/* Pose : la carte arrive en vol, tournoie sur elle-même (flip 3D grâce à
   perspective() dans le transform, aucun prérequis DOM) puis se pose avec un
   léger dépassement. Longue et lisible, y compris sur mobile. */
@keyframes carte-pose {
  0%   { transform: perspective(600px) translateY(-56px) rotate(-18deg) rotateY(88deg); opacity: 0; }
  45%  { opacity: 1; }
  70%  { transform: perspective(600px) translateY(5px) rotate(4deg) rotateY(-14deg); }
  100% { transform: none; opacity: 1; }
}

/* Pioche : petit arc depuis le talon vers la main */
@keyframes pioche-arc {
  0% { transform: translate(16vw, -30vh) rotate(14deg) scale(0.7); opacity: 0.5; }
  100% { transform: none; opacity: 1; }
}

/* +2/+4 : secousse légère du tapis */
@keyframes shake-table {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Changement de sens : la flèche pivote */
@keyframes fleche-tourne {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Victoire : pop d'entrée de l'écran de fin */
@keyframes victoire-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

.anim-deal { animation: deal-vol 0.6s cubic-bezier(.2,.8,.3,1) backwards; }
.anim-pose { animation: carte-pose 0.6s cubic-bezier(.3,.7,.3,1) backwards; }
.anim-pioche { animation: pioche-arc 0.5s ease-out backwards; }
.anim-shake { animation: shake-table 0.4s ease-in-out; }
.anim-sens { animation: fleche-tourne 0.5s cubic-bezier(.3,.7,.3,1.2); }
.anim-victoire { animation: victoire-pop 0.6s cubic-bezier(.2,.9,.3,1.2) backwards; }

@media (prefers-reduced-motion: reduce) {
  .anim-deal, .anim-pose, .anim-pioche, .anim-shake, .anim-sens, .anim-victoire {
    animation: none;
  }
}


/* ================= Podium Marathon (S7) ================= */
.podium {
  list-style: none;
  margin: 12px auto 0;
  padding: 0;
  max-width: 320px;
  text-align: left;
}
.podium-ligne {
  padding: 8px 14px;
  margin: 6px 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}
.podium-ligne:first-child {
  background: rgba(255, 215, 0, 0.22);
  border: 1px solid rgba(255, 215, 0, 0.5);
}


/* ---- Panneau de contrôle du son ---- */
.panneau-son {
  position: fixed;
  top: 56px; right: 12px;
  z-index: 60;
  background: #10243a;
  border: 1px solid #2b4368;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

.ligne-son {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dce8f5;
  font-size: .9rem;
  cursor: pointer;
}

.ligne-son input[type="range"] {
  flex: 1;
  accent-color: #f7b801;
}

.ligne-son input[type="checkbox"] {
  accent-color: #f7b801;
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .carte.zoom,
  #zone-defausse.depot-actif {
    animation: none;
  }
}


/* ============================================================
   Administration (/admin.html)
   ============================================================ */

body.admin {
  background: radial-gradient(120% 100% at 50% 0%, #1a1530 0%, #0d0f1c 60%);
}

.admin-badge {
  font-style: normal;
  font-size: .45em;
  vertical-align: middle;
  background: var(--jaune);
  color: #1a1a1a;
  border-radius: 8px;
  padding: .15em .5em;
  margin-left: .4em;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.admin-barre {
  display: flex;
  align-items: center;
  gap: .8em;
  padding: .8em 1em;
  border-bottom: 1px solid var(--ligne);
  position: sticky;
  top: 0;
  background: rgba(13, 15, 28, .92);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.admin-titre {
  font-size: 1.15rem;
  margin: 0;
  flex: none;
}

.admin-barre .indice {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-onglets {
  display: flex;
  gap: .5em;
  padding: .8em 1em 0;
}

.admin-onglets .onglet {
  border-radius: 10px 10px 0 0;
  padding: .6em 1.2em;
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-bottom: none;
  color: var(--texte-sombre);
  font-weight: 600;
}

.admin-onglets .onglet.actif {
  background: var(--panneau-clair);
  color: var(--texte);
}

.admin-vue {
  padding: 1em;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.admin-cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .8em;
}

.admin-carte {
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 14px;
  padding: .9em 1em;
}

.admin-carte-titre {
  color: var(--texte-sombre);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.admin-carte-valeur {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: .15em;
}

.admin-sous-titre {
  margin: .2em 0 0;
  font-size: 1rem;
}

.admin-tableau {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 14px;
  overflow: hidden;
  font-size: .92rem;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: .55em .7em;
  border-bottom: 1px solid var(--ligne);
  vertical-align: top;
}

.admin-table th {
  color: var(--texte-sombre);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--panneau-clair);
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-ligne-dormante { opacity: .55; }

.admin-statut {
  display: inline-block;
  border-radius: 999px;
  padding: .1em .6em;
  font-size: .8rem;
  font-weight: 700;
}

.admin-statut-lobby { background: rgba(247, 184, 1, .18); color: var(--jaune); }
.admin-statut-playing { background: rgba(47, 158, 68, .18); color: #6ee7a0; }
.admin-statut-finished { background: rgba(148, 163, 184, .18); color: var(--texte-sombre); }

.admin-joueur {
  display: inline-block;
  background: var(--panneau-clair);
  border: 1px solid var(--ligne);
  border-radius: 999px;
  padding: .08em .55em;
  margin: .1em .15em .1em 0;
  font-size: .85rem;
}

.admin-joueur-off { opacity: .5; text-decoration: line-through; }

.admin-actions { white-space: nowrap; }
.admin-actions .btn-icone { width: 32px; height: 32px; font-size: .9rem; margin-left: .25em; }

.admin-detail {
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 14px;
  padding: 1em;
}

.admin-detail-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8em;
}

.admin-detail-entete h3 { margin: 0; }

.admin-detail .admin-table { margin-top: .6em; }

.admin-oui { color: #6ee7a0; font-weight: 600; }
.admin-non { color: var(--texte-sombre); }

.admin-deux-colonnes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5em;
}

.admin-top { margin: 0; padding-left: 1.4em; }
.admin-top-ligne { padding: .15em 0; }

.admin-purge {
  background: var(--panneau);
  border: 1px solid var(--ligne);
  border-radius: 14px;
  padding: .9em 1em;
}

.admin-form-inline {
  display: flex;
  align-items: center;
  gap: .6em;
  flex-wrap: wrap;
}

.admin-input-nombre { width: 5.5em; }

@media (max-width: 640px) {
  .admin-table { font-size: .82rem; }
  .admin-table th, .admin-table td { padding: .45em .5em; }
  .admin-carte-valeur { font-size: 1.2rem; }
}


/* ---------- Administration : outils de liste (recherche, chips, sélection) ---------- */

.admin-outils {
  display: flex;
  align-items: center;
  gap: .8em;
  flex-wrap: wrap;
}

.admin-recherche {
  flex: 1 1 220px;
  min-width: 180px;
}

.admin-chips {
  display: flex;
  gap: .4em;
  flex-wrap: wrap;
}

.admin-chip {
  border: 1px solid var(--ligne);
  background: var(--panneau);
  color: var(--texte-sombre);
  border-radius: 999px;
  padding: .3em .8em;
  font-size: .85rem;
  font-weight: 600;
}

.admin-chip:hover { border-color: var(--texte-sombre); }

.admin-chip.actif {
  background: var(--panneau-clair);
  color: var(--texte);
  border-color: var(--jaune);
}

.admin-chip-n {
  display: inline-block;
  background: var(--panneau-clair);
  border-radius: 999px;
  padding: 0 .5em;
  margin-left: .3em;
  font-size: .8rem;
}

.admin-chip.actif .admin-chip-n { background: var(--panneau); }

.admin-barre-selection {
  display: flex;
  align-items: center;
  gap: .8em;
  flex-wrap: wrap;
  background: rgba(247, 184, 1, .08);
  border: 1px solid rgba(247, 184, 1, .35);
  border-radius: 12px;
  padding: .5em .8em;
}

.admin-barre-selection span { font-weight: 700; }

.admin-btn-danger {
  border-color: rgba(220, 38, 38, .5);
  color: #ff9c9c;
}

.admin-btn-danger:hover { background: rgba(220, 38, 38, .15); }

.admin-col-coche { width: 36px; text-align: center; }

.admin-col-coche input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--jaune);
  cursor: pointer;
}

th.admin-col-tri { cursor: pointer; user-select: none; white-space: nowrap; }
th.admin-col-tri:hover { color: var(--texte); }

.admin-tri-fleche { font-size: .75em; margin-left: .25em; }

@media (max-width: 640px) {
  .admin-outils { gap: .5em; }
  .admin-barre-selection { gap: .5em; font-size: .9rem; }
}
