/* Hexis — arène claire : pierre crème, filets or, icônes nettes.
   Couleurs des cartes d'origine conservées : ❤ vert, 🔥 rouge, € bleu. */

:root {
  --creme: #fbf6ea;
  --blanc: #fffdf8;
  --pierre: #f1e6cf;
  --pierre-2: #e6d6b4;
  --pierre-3: #cfb685;
  --trait: #dcc79e;
  --or: #d39a24;
  --or-vif: #f5bd3c;
  --or-fonce: #8c5c10;
  --encre: #2f2618;
  --encre-2: #6c5a40;

  --pv: #2a9d44;
  --degats: #d8392e;
  --argent: #2f6bdc;
  --soin: #2fb36b;

  --j1: #168aa5;
  --j1-clair: #d7eff4;
  --j2: #d64a3a;
  --j2-clair: #f9ddd8;

  /* couleur d'équipe des dessins : neutre (sable) hors du plateau */
  --art: #e2a93b;
  --art-fonce: #b8812a;

  --ombre: 0 2px 0 rgba(140, 92, 16, 0.12), 0 6px 18px rgba(96, 70, 30, 0.12);

  --titre: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --texte: "Mulish", system-ui, sans-serif;

  --icone-pv: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 2.9 4.5 6.6 4.5c2.2 0 3.6 1.3 4.4 2.6.8-1.3 2.2-2.6 4.4-2.6 3.7 0 5.7 3.9 4.2 7.3C19.5 16.4 12 21 12 21z' fill='%232a9d44'/%3E%3C/svg%3E");
  --icone-degats: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5c.8 3.2 3.4 4.9 4.9 7.4 1.6 2.6 1.4 6-.6 8.2A6.5 6.5 0 0 1 5.6 16c-.7-2.6.2-5 1.9-6.9.2 1.6.9 2.7 2 3.3-.3-3.9.7-7.2 2.5-9.9z' fill='%23d8392e'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
  margin: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--encre-2);
  font-family: var(--texte);
  background: var(--creme) url("fond.svg") center bottom / cover no-repeat fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--titre);
  font-weight: 700;
  color: var(--encre);
  letter-spacing: 0.01em;
}

:focus-visible {
  outline: 3px solid var(--argent);
  outline-offset: 3px;
}

/* =========================================================
   Dessins SVG (illustrations.js)
   ========================================================= */

.art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.art .eq   { fill: var(--art); }
.art .eq-f { fill: var(--art-fonce); }

.carte-art > .art {
  width: 80px;
  height: 80px;
}

.boutique .carte-art > .art {
  width: 44px;
  height: 44px;
}

.carte-badges .art,
.hex-badges .art {
  width: 74%;
  height: 74%;
}

.hex-icone {
  display: block;
  width: calc(var(--hex) * 0.46);
  height: calc(var(--hex) * 0.46);
}

.base-bandeau .avatar .art,
.profil-avatar .art {
  width: 76%;
  height: 76%;
}

.menu-icone {
  display: grid;
  place-items: center;
}

.menu-icone .art {
  width: 22px;
  height: 22px;
}

.icone .art {
  width: 66%;
  height: 66%;
}

.ruche.j1,
.base-bandeau.j1,
.fiche[data-joueur="0"],
.profil-avatar {
  --art: #3aa6c4;
  --art-fonce: #1f7f9a;
}

.ruche.j2,
.base-bandeau.j2,
.fiche[data-joueur="1"] {
  --art: #e76050;
  --art-fonce: #b8412f;
}

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

/* Bouton principal en flèche dorée (Jouer, Confirmer, Terminer le tour). */
.btn-jouer,
.btn-confirmer {
  --fleche: 16px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 calc(26px + var(--fleche)) 0 26px;
  height: 46px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #3b2506;
  background: var(--or-fonce);
  border: 0;
  clip-path: polygon(0 0, calc(100% - var(--fleche)) 0, 100% 50%, calc(100% - var(--fleche)) 100%, 0 100%);
  cursor: pointer;
  transition: filter 0.15s;
}

.btn-jouer::before,
.btn-confirmer::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: -1;
  background: linear-gradient(180deg, #ffe08a, var(--or-vif) 55%, #e49f22);
  clip-path: polygon(0 0, calc(100% - var(--fleche) + 1px) 0, 100% 50%, calc(100% - var(--fleche) + 1px) 100%, 0 100%);
}

.btn-jouer:hover,
.btn-confirmer:hover {
  filter: brightness(1.06) saturate(1.1);
}

.btn-jouer:active,
.btn-confirmer:active {
  filter: brightness(0.92);
}

/* Bouton secondaire : blanc cerclé d'or */
.btn-or {
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 24px;
  font-family: var(--titre);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--encre);
  background: var(--blanc);
  border: 2px solid var(--or);
  border-radius: 10px;
  box-shadow: var(--ombre);
  transition: border-color 0.15s, background 0.15s;
}

.btn-or:hover {
  background: #fff6dc;
}

.btn-or.discret {
  background: transparent;
  border-color: var(--pierre-3);
  box-shadow: none;
}

/* =========================================================
   Barre du client (toutes les pages sauf la partie)
   ========================================================= */

.client-barre {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 76px;
  padding: 0 28px;
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 2px solid var(--trait);
  box-shadow: 0 4px 16px rgba(96, 70, 30, 0.08);
}

.logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.5rem;
  color: #3b2506;
  background: radial-gradient(circle at 40% 30%, #ffe8a8, var(--or-vif) 70%);
  border: 2px solid var(--or-fonce);
  border-radius: 50%;
}

/* numéro de version (version.js) */
.version {
  padding: 2px 9px;
  font-family: var(--titre);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--encre-2);
  background: var(--blanc);
  border: 1.5px solid var(--trait);
  border-radius: 999px;
  white-space: nowrap;
}

.version:empty {
  display: none;
}

.client-barre .version {
  margin-left: -18px; /* collé au logo */
}

/* la pastille ouvre les patch notes */
button.version {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

button.version:hover {
  color: var(--encre);
  background: #fff3d6;
  border-color: var(--or);
}

/* ---------- Fenêtre des patch notes (version.js) ---------- */
.patch-notes {
  width: min(560px, calc(100% - 32px));
  max-height: min(640px, calc(100% - 32px));
  margin: auto; /* centrée (le reset global met margin: 0) */
  padding: 0; /* les clics sur la marge = clics sur le fond, qui ferment la fenêtre */
  color: var(--encre);
  background: var(--blanc);
  border: 2px solid var(--or);
  border-top: 8px solid var(--or-vif);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(60, 45, 20, 0.3);
}

.patch-notes[open] {
  display: flex;
  flex-direction: column;
  animation: ouverture-patch 0.2s ease-out;
}

.patch-notes::backdrop {
  background: rgba(60, 45, 20, 0.4);
  backdrop-filter: blur(4px);
}

@keyframes ouverture-patch {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

.patch-haut {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 14px;
  border-bottom: 2px solid var(--trait);
}

.patch-haut h2 {
  margin-top: 4px;
  font-size: 1.45rem;
}

.patch-fermer {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1rem;
  color: var(--encre-2);
  background: var(--creme);
  border: 2px solid var(--trait);
  border-radius: 50%;
  cursor: pointer;
}

.patch-fermer:focus-visible {
  outline: 3px solid var(--or-vif);
  outline-offset: 2px;
}

.patch-fermer:hover {
  color: var(--encre);
  border-color: var(--or);
}

.patch-contenu {
  overflow-y: auto;
  padding: 18px 24px 24px;
}

.patch-version + .patch-version {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px dashed var(--trait);
}

.patch-entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 12px;
}

.patch-entete h3 {
  font-size: 1.15rem;
}

.patch-entete time {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--encre-2);
}

.patch-version ul {
  display: grid;
  gap: 8px;
  padding-left: 20px;
  line-height: 1.5;
}

.patch-version li::marker {
  color: var(--or);
}

/* petits correctifs (0.2a, 0.2b…) repliés derrière le bouton « Détails » */
.patch-correctifs {
  margin-top: 14px;
}

.patch-correctifs summary,
.patch-plus summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  font-family: var(--titre);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--encre-2);
  background: var(--creme);
  border: 1.5px solid var(--trait);
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  transition: border-color 0.15s, background 0.15s;
}

.patch-correctifs summary::-webkit-details-marker,
.patch-plus summary::-webkit-details-marker {
  display: none;
}

.patch-correctifs summary::before,
.patch-plus summary::before {
  content: "▸";
  font-size: 0.8em;
  transition: transform 0.15s;
}

.patch-correctifs[open] summary::before,
.patch-plus[open] summary::before {
  transform: rotate(90deg);
}

.patch-correctifs summary:hover,
.patch-plus summary:hover {
  color: var(--encre);
  background: #fff3d6;
  border-color: var(--or);
}

.patch-correctifs summary:focus-visible,
.patch-plus summary:focus-visible {
  outline: 3px solid var(--or-vif);
  outline-offset: 2px;
}

.patch-correctif {
  margin-top: 10px;
  padding: 10px 14px 12px;
  font-size: 0.92rem;
  background: var(--creme);
  border-left: 3px solid var(--trait);
  border-radius: 10px;
}

.patch-correctif .patch-entete {
  margin-bottom: 6px;
}

/* cartes buffées / nerfées : dessin + étiquette jaune, barre orange (BUFF) / bleue (NERF) */
.patch-cartes {
  display: grid;
  gap: 8px;
}

.patch-carte {
  display: flex;
  align-items: center;
}

.patch-carte-art {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
}

.patch-carte-art .art {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 0 rgba(47, 38, 24, 0.25));
}

.patch-carte-nom {
  position: absolute;
  left: -4px;
  bottom: -2px;
  padding: 1px 6px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--encre);
  background: #f7d64a;
  border: 1.5px solid var(--encre);
  border-radius: 3px;
  transform: rotate(-5deg);
}

.patch-barre {
  flex: 1;
  min-width: 0; /* sinon la barre élargit la fenêtre sur téléphone */
  display: flex;
  height: 38px;
  margin-left: -14px; /* passe sous le dessin */
  overflow: hidden;
  background: #cfe6f5;
  border-radius: 4px 10px 10px 4px;
}

.patch-buff,
.patch-nerf {
  display: flex;
  align-items: center;
  min-width: max-content;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.patch-buff {
  justify-content: flex-end;
  padding: 0 12px 0 24px;
  color: var(--blanc);
  background: #f59a3c;
  text-shadow: 0 0 2px var(--encre), 0 1px 0 var(--encre), 0 -1px 0 var(--encre), 1px 0 0 var(--encre), -1px 0 0 var(--encre);
}

.patch-nerf {
  justify-content: flex-start;
  padding: 0 12px 0 24px;
  color: #1d4f80;
  background: #8ec9ec;
}

.patch-buff + .patch-nerf {
  padding-left: 12px;
}

/* « Plus » : les chiffres exacts */
.patch-plus {
  margin: 12px 0 14px;
}

.patch-plus dl {
  display: grid;
  gap: 2px;
  margin-top: 10px;
  padding: 10px 14px 12px;
  font-size: 0.92rem;
  background: var(--creme);
  border-left: 3px solid var(--trait);
  border-radius: 10px;
}

.patch-plus dt {
  margin-top: 6px;
  font-family: var(--titre);
  font-weight: 600;
}

.patch-plus dt:first-child {
  margin-top: 0;
}

.patch-plus dd {
  margin-left: 12px;
  color: var(--encre-2);
}

.patch-plus dd strong {
  color: var(--encre);
}

.onglets {
  display: flex;
  align-self: stretch;
  gap: 4px;
}

.onglets a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-family: var(--titre);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--encre-2);
  border-bottom: 3px solid transparent;
  transition: color 0.15s;
}

.onglets a:hover {
  color: var(--encre);
}

.onglets a.actif {
  color: var(--encre);
  border-bottom-color: var(--or);
}

.profil {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profil-avatar {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  border-radius: 50%;
  background: var(--j1-clair);
  border: 2px solid var(--or);
}

.profil-nom {
  font-weight: 800;
  color: var(--encre);
}

.profil-statut {
  font-size: 0.85rem;
  color: var(--j1);
}

/* =========================================================
   Accueil
   ========================================================= */

.accueil {
  flex: 1;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.menu-lateral {
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  background: rgba(255, 253, 248, 0.82);
  border-right: 2px solid var(--trait);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  font-family: var(--titre);
  font-weight: 600;
  font-size: 1rem;
  color: var(--encre);
  transition: background 0.15s;
}

.menu-item:hover {
  background: #fff3d6;
}

.menu-icone {
  width: 24px;
  font-size: 1.15rem;
  text-align: center;
}

.menu-separateur {
  height: 2px;
  margin: 10px 20px;
  background: var(--trait);
}

.accueil-contenu {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}

.vitrine {
  max-width: 660px;
  padding: 56px 56px 0;
}

.surtitre {
  font-family: var(--titre);
  font-weight: 600;
  font-size: 1rem;
  color: var(--or-fonce);
}

.vitrine h1 {
  margin: 12px 0 22px;
  font-size: clamp(2.6rem, 5.4vw, 4.4rem);
  line-height: 1.02;
  text-transform: uppercase;
}

.vitrine-texte {
  max-width: 52ch;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--encre);
}

.vitrine-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

/* bandeau du bas, comme le carrousel d'un client */
.banniere {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 32px 56px;
  background: rgba(255, 253, 248, 0.9);
  border-top: 2px solid var(--trait);
}

.banniere-texte {
  max-width: 520px;
}

.banniere h2 {
  margin: 6px 0 10px;
  font-size: 2rem;
  text-transform: uppercase;
}

.banniere p:last-child {
  line-height: 1.6;
  color: var(--encre);
}

.carte-vedette {
  margin-right: 24px;
  transform: rotate(4deg);
  cursor: default;
}

/* =========================================================
   Choix du mode
   ========================================================= */

.modes {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 48px 48px 32px;
}

.modes-liste {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.mode {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 16px 32px;
  text-align: center;
  background: rgba(255, 253, 248, 0.85);
  border: 2px solid var(--trait);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

/* le bouton radio est caché, c'est tout le bloc qu'on clique */
.mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-embleme {
  width: 108px;
  height: 108px;
  margin-bottom: 20px;
  transition: transform 0.2s;
}

.mode-format {
  font-family: var(--titre);
  font-weight: 600;
  font-size: 1rem;
  color: var(--encre-2);
}

.mode-nom {
  margin-top: 6px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--encre);
}

.mode:hover {
  border-color: var(--or);
}

/* mode sélectionné : cadre or épais et fond doré */
.mode:has(input:checked) {
  background: linear-gradient(180deg, #fff8e2, #ffeec2);
  border-color: var(--or);
  box-shadow: 0 0 0 3px rgba(245, 189, 60, 0.35), var(--ombre);
}

.mode:has(input:checked) .mode-embleme {
  transform: scale(1.06);
}

.mode:has(input:focus-visible) {
  outline: 3px solid var(--argent);
  outline-offset: 4px;
}

.mode.bientot {
  cursor: not-allowed;
}

.mode.bientot:hover {
  border-color: var(--trait);
}

.mode.bientot .mode-embleme,
.mode.bientot .mode-nom,
.mode.bientot .mode-format {
  opacity: 0.45;
}

.mode-badge {
  margin-top: 14px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--or-fonce);
  background: #fff3d6;
  border-radius: 99px;
}

.modes-detail {
  max-width: 480px;
  padding: 28px 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--encre);
}

.modes-regles {
  margin-top: 18px;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--trait);
}

.modes-regles li {
  display: flex;
  gap: 16px;
  padding: 9px 0;
  font-size: 0.98rem;
  border-bottom: 1px solid var(--trait);
}

.modes-regles span {
  flex: 0 0 90px;
  font-family: var(--titre);
  font-weight: 600;
  color: var(--or-fonce);
}

.modes-confirmation {
  margin-top: auto;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--blanc);
  border: 2px solid var(--trait);
  border-radius: 14px;
  box-shadow: var(--ombre);
}

.btn-annuler {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 1.1rem;
  color: var(--encre);
  border: 2px solid var(--pierre-3);
  border-radius: 50%;
  transition: border-color 0.15s;
}

.btn-annuler:hover {
  border-color: var(--or);
}

.modes-confirmation .btn-confirmer {
  min-width: 240px;
}

/* =========================================================
   Pages de contenu (Collection, Règles)
   ========================================================= */

.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px;
}

.page-entete {
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--trait);
}

.page-entete h1 {
  font-size: 2.6rem;
  text-transform: uppercase;
}

.page-entete p {
  margin-top: 6px;
  color: var(--encre);
}

.grille-cartes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 30px 22px;
  padding-top: 14px;
}

.grille-cartes .carte {
  width: auto;
}

.regles ul:not(.icones) {
  padding-left: 1.2em;
}

.regles li + li {
  margin-top: 6px;
}

.regles section {
  max-width: 68ch;
  margin-bottom: 30px;
}

.regles h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.regles p,
.regles li {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--encre);
}

.icones {
  padding: 0;
  list-style: none;
}

.icones li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--trait);
}

.icone {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--blanc);
  border: 2px solid var(--trait);
  border-radius: 50%;
}

.icones strong {
  color: var(--encre);
}

/* =========================================================
   Carte (collection, boutique, fiche)
   ========================================================= */

.carte {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  width: 150px;
  padding: 6px 6px 10px;
  color: var(--encre-2);
  background: linear-gradient(180deg, var(--blanc), #f8efdc);
  border: 2px solid var(--trait);
  border-radius: 12px;
  box-shadow: var(--ombre);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.carte:hover {
  border-color: var(--or);
  transform: translateY(-4px);
}

/* pas assez d'argent / terrain plein */
.carte.trop-cher {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.5;
}

.carte.trop-cher:hover {
  border-color: var(--trait);
  transform: none;
}

/* coût : pièce bleue cerclée d'or */
.carte-cout {
  position: absolute;
  top: -12px;
  left: -12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #79a8ff, var(--argent) 60%, #1d47a3);
  border: 2px solid var(--or-vif);
  border-radius: 50%;
}

.carte-art {
  position: relative;
  display: grid;
  place-items: center;
  height: 92px;
  font-size: 3rem;
  /* unités : fond turquoise clair */
  background: radial-gradient(circle at 50% 70%, #ffffff, var(--j1-clair) 70%);
  border-radius: 8px;
}

/* bâtiments : fond sable */
.carte.batiment .carte-art {
  background: radial-gradient(circle at 50% 70%, #ffffff, #f6e0b0 70%);
}

/* ☣ immunisé poison, 🌀 sans repos, 🧪 toxique */
.carte-badges {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 3px;
}

.carte-badges span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 0.8rem;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: 50%;
}

.carte-nom {
  margin: 9px 2px 7px;
  font-size: 0.98rem;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.carte-stats {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--encre);
}

.stat::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  background: center / contain no-repeat;
}

.stat.pv::before     { background-image: var(--icone-pv); }
.stat.degats::before { background-image: var(--icone-degats); }

.carte-special {
  margin: 8px 2px 0;
  padding-top: 7px;
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: center;
  color: var(--encre-2);
  border-top: 1px solid var(--trait);
}

/* =========================================================
   Écran de partie
   ========================================================= */

body.jeu {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background-attachment: scroll;
}

.jeu-barre {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 52px;
  padding: 0 20px;
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 2px solid var(--trait);
}

.btn-quitter {
  justify-self: start;
  font-family: var(--titre);
  font-weight: 600;
  color: var(--encre-2);
}

.btn-quitter:hover {
  color: var(--encre);
}

.plaque-tour {
  padding: 5px 22px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  color: #3b2506;
  background: linear-gradient(180deg, #ffe08a, var(--or-vif));
  border: 2px solid var(--or-fonce);
  border-radius: 99px;
}

.jeu-centre {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* chrono du tour : secondes + barre qui se vide */
.chrono {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 34px;
  padding: 0 12px 4px;
  overflow: hidden;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--encre);
  background: var(--blanc);
  border: 2px solid var(--trait);
  border-radius: 99px;
}

.chrono-piste {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--pierre-2);
}

.chrono-barre {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--j1);
  transition: width 0.2s linear;
}

body[data-actif="1"] .chrono-barre {
  background: var(--j2);
}

.chrono.urgent {
  color: var(--degats);
  border-color: var(--degats);
  animation: pulse-chrono 1s ease-in-out infinite;
}

.chrono.urgent .chrono-barre {
  background: var(--degats);
}

/* pas de scale ici : agrandir une pastille arrondie avec overflow:hidden
   fait apparaître des fines lignes carrées pendant l'animation */
@keyframes pulse-chrono {
  50% { background: var(--j2-clair); }
}

.jeu-droite {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.jeu-mode {
  font-family: var(--titre);
  font-weight: 600;
  color: var(--encre-2);
}

/* mode Entraînement : pendant le tour de l'IA, le joueur regarde */
.jeu.ia-joue .arene {
  cursor: progress;
}

#fin-tour:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(0.4);
}

/* bouton couper / remettre le son */
.btn-son {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--trait);
  border-radius: 50%;
  background: var(--blanc);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.btn-son:hover {
  border-color: var(--or);
  transform: scale(1.06);
}

.btn-son .art {
  width: 22px;
  height: 22px;
}

/* ---------- Arène ---------- */

.arene {
  position: relative;
  flex: 1;
  min-height: 0;
  container-type: size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(255, 253, 248, 0.85), rgba(255, 253, 248, 0) 75%),
    linear-gradient(180deg, rgba(230, 214, 180, 0.35), rgba(241, 230, 207, 0.2) 50%, rgba(230, 214, 180, 0.35));
}

/* ---------- Bandeau de base (cliquable comme cible) ---------- */

.base-bandeau {
  --equipe: var(--j1);
  --equipe-clair: var(--j1-clair);
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto auto minmax(60px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: min(640px, 100%);
  height: 50px;
  padding: 0 12px 0 6px;
  text-align: left;
  background: var(--blanc);
  border: 2px solid var(--trait);
  border-left: 6px solid var(--equipe);
  border-radius: 12px;
  box-shadow: var(--ombre);
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.base-bandeau.j2 {
  --equipe: var(--j2);
  --equipe-clair: var(--j2-clair);
}

.base-bandeau.actif {
  border-color: var(--equipe);
}

.base-bandeau .avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
  background: var(--equipe-clair);
  border: 2px solid var(--equipe);
  border-radius: 50%;
}

.base-nom {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--encre);
  white-space: nowrap;
}

/* jauge graduée tous les 10 PV */
.jauge {
  position: relative;
  height: 14px;
  background: var(--pierre-2);
  border-radius: 99px;
  overflow: hidden;
}

.jauge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(255, 253, 248, 0.8) calc(10% - 2px) 10%);
}

.jauge-remplie {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #6ad27c, var(--pv));
  border-radius: 99px;
  transition: width 0.5s;
}

.base-bandeau.critique .jauge-remplie {
  background: linear-gradient(180deg, #f07a6e, var(--degats));
}

.base-pv,
.argent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--encre);
}

.base-pv {
  min-width: 3.2em;
}

.base-pv::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  background: var(--icone-pv) center / contain no-repeat;
}

.argent::before {
  content: "€";
  display: grid;
  place-items: center;
  width: 1.45em;
  height: 1.45em;
  font-size: 0.8em;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #79a8ff, var(--argent) 60%, #1d47a3);
  border: 1.5px solid var(--or-vif);
  border-radius: 50%;
}

.argent.grand {
  font-size: 1.5rem;
}

/* la base est une cible possible */
.base-bandeau.cible {
  border-color: var(--degats);
  box-shadow: 0 0 0 4px rgba(216, 57, 46, 0.25), var(--ombre);
  cursor: crosshair;
  animation: pulse-cible 1.1s ease-in-out infinite;
}

.base-bandeau.soignable {
  border-color: var(--soin);
  box-shadow: 0 0 0 4px rgba(47, 179, 107, 0.28), var(--ombre);
  cursor: pointer;
}

@keyframes pulse-cible {
  50% { box-shadow: 0 0 0 7px rgba(216, 57, 46, 0.12), var(--ombre); }
}

/* ---------- Ruche d'hexagones ---------- */

.ruche {
  /* taille d'un hexagone : s'adapte à la place dispo dans l'arène */
  --colonnes: 10;
  --rangees: 2;
  --reserve: 0px; /* place de la fiche à droite sur grand écran */
  --hex: clamp(40px, min((100cqw - 40px - var(--reserve)) / (var(--colonnes) + 0.7), (100cqh - 196px) / (2.31 * (0.25 + 0.75 * var(--rangees)) + 0.1)), 112px);
  --h: calc(var(--hex) * 1.1547);
  --ecart: 5px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rangee {
  display: flex;
  gap: var(--ecart);
  transform: translateX(calc((var(--hex) + var(--ecart)) / -4));
}

.rangee.decalee {
  transform: translateX(calc((var(--hex) + var(--ecart)) / 4));
}

.rangee + .rangee {
  margin-top: calc(var(--h) / -4 + var(--ecart) * 0.87);
}

.hex {
  position: relative;
  width: var(--hex);
  height: var(--h);
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

/* forme : le fond = la bordure, ::before = l'intérieur 3px plus petit */
.hex-forme {
  --bord: var(--pierre-3);
  --fond: rgba(255, 253, 248, 0.6);
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--hex) * 0.02);
  background: var(--bord);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.hex-forme::before {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--fond);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.hex-forme > * {
  position: relative;
}

.hex.vide .hex-forme {
  --bord: var(--pierre-2);
  --fond: rgba(255, 253, 248, 0.45);
}

.hex.vide {
  cursor: default;
}

/* carte posée : fond selon le type, bord selon le camp */
.hex.unite .hex-forme {
  --fond: radial-gradient(circle at 50% 40%, #ffffff, var(--j1-clair) 85%);
}

.hex.batiment .hex-forme {
  --fond: radial-gradient(circle at 50% 40%, #ffffff, #f6e0b0 85%);
}

.ruche.j1 { --bord-camp: #7fbfcf; }
.ruche.j2 { --bord-camp: #e3a79e; }

.hex:not(.vide) .hex-forme {
  --bord: var(--bord-camp);
}

.hex-cout {
  display: grid;
  place-items: center;
  min-width: calc(var(--hex) * 0.2);
  height: calc(var(--hex) * 0.2);
  padding: 0 3px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: max(10px, calc(var(--hex) * 0.12));
  line-height: 1;
  color: #fff;
  background: var(--argent);
  border-radius: 99px;
}

.hex-icone {
  font-size: calc(var(--hex) * 0.34);
  line-height: 1.05;
}

.hex-stats {
  display: flex;
  gap: calc(var(--hex) * 0.07);
}

.hex-stats .stat {
  gap: 2px;
  font-size: max(11px, calc(var(--hex) * 0.15));
}

.stat.pv.blesse {
  color: var(--degats);
}

/* carte empoisonnée (Tourelle toxique) : PV verts et pastille « -5 » */
.hex.empoisonne .stat.pv {
  color: #4f8f1c;
}

.hex-badges .badge-poison {
  font-family: var(--titre);
  font-weight: 700;
  color: #2f5a0c;
  background: #dcf5bf;
  border-color: #6aa832;
}

/* carte en attente : protégée (on ne peut pas la viser avant son premier tour) */
.hex.attente {
  filter: drop-shadow(0 0 4px rgba(127, 182, 238, 0.95));
}

.hex-badges .badge-protege {
  background: #e4f1fd;
  border-color: #7fb6ee;
}

.fiche-poison {
  font-weight: 700;
  color: #4f8f1c;
}

/* carte protégée par un Bastion (-2 dégâts par coup) */
.hex-badges .badge-bastion {
  background: #eaf6fc;
  border-color: #5fb3d9;
}

.fiche-bastion {
  font-weight: 700;
  color: #2b7ea6;
}

.hex-badges {
  position: absolute;
  top: 6%;
  right: -4%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hex-badges span {
  display: grid;
  place-items: center;
  width: max(18px, calc(var(--hex) * 0.22));
  height: max(18px, calc(var(--hex) * 0.22));
  font-size: max(10px, calc(var(--hex) * 0.12));
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: 50%;
}

.hex-etat {
  position: absolute;
  left: 50%;
  bottom: 2%;
  transform: translateX(-50%);
  padding: 2px 7px;
  font-size: max(9px, calc(var(--hex) * 0.1));
  font-weight: 800;
  white-space: nowrap;
  color: #fff;
  background: var(--encre-2);
  border-radius: 99px;
}

/* --- états --- */

/* en attente : voile clair, pas d'attaque ce tour */
.hex.attente .hex-icone,
.hex.attente .hex-stats {
  opacity: 0.55;
  filter: grayscale(0.6);
}

/* prête : bord or + halo */
.hex.pret .hex-forme {
  --bord: var(--or-vif);
}

.hex.pret {
  filter: drop-shadow(0 0 5px rgba(245, 189, 60, 0.9));
}

/* a fini son tour */
.hex.epuise .hex-forme {
  filter: saturate(0.4);
  opacity: 0.75;
}

.hex.selection {
  z-index: 2;
  transform: scale(1.08);
  filter: drop-shadow(0 0 4px var(--or-vif)) drop-shadow(0 0 10px rgba(211, 154, 36, 0.9));
}

.hex.selection .hex-forme {
  --bord: var(--or-fonce);
}

.hex.inspection .hex-forme {
  --bord: var(--argent);
}

.hex.cible {
  cursor: crosshair;
  filter: drop-shadow(0 0 3px var(--degats)) drop-shadow(0 0 8px rgba(216, 57, 46, 0.9));
  animation: pulse-hex 1.1s ease-in-out infinite;
}

.hex.cible .hex-forme {
  --bord: var(--degats);
}

.hex.cible .hex-etat {
  background: var(--degats);
}

.hex.soignable {
  filter: drop-shadow(0 0 5px rgba(47, 179, 107, 0.95));
}

.hex.soignable .hex-forme {
  --bord: var(--soin);
}

.hex.destination {
  cursor: pointer;
}

.hex.destination .hex-forme {
  --bord: var(--or);
  --fond: rgba(255, 243, 214, 0.85);
}

.hex:not(.vide):hover,
.hex.destination:hover {
  transform: translateY(-2px);
}

.hex.selection:hover {
  transform: scale(1.08);
}

@keyframes pulse-hex {
  50% { transform: scale(1.05); }
}

/* ---------- Ligne de front ---------- */

.front {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
}

.front::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--or) 20%, var(--or) 80%, transparent);
}

.consigne {
  position: relative;
  max-width: min(680px, 94%);
  padding: 7px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  color: var(--encre);
  background: var(--blanc);
  border: 2px solid var(--or);
  border-radius: 99px;
  box-shadow: var(--ombre);
}

/* ---------- Fiche de la carte sélectionnée ---------- */

.fiche {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 180px;
  padding: 18px 12px 12px;
  font-size: 0.88rem;
  color: var(--encre);
  background: rgba(255, 253, 248, 0.95);
  border: 2px solid var(--trait);
  border-radius: 14px;
  box-shadow: var(--ombre);
}

.fiche .carte {
  width: auto;
  margin-bottom: 6px;
  cursor: default;
  box-shadow: none;
}

.fiche .carte:hover {
  transform: none;
}

.fiche-camp {
  font-family: var(--titre);
  font-weight: 700;
}

.fiche-pv strong {
  font-size: 1.1rem;
  color: var(--pv);
}

.fiche-etat {
  color: var(--encre-2);
}

/* ---------- Chiffres qui s'envolent ---------- */

.flottant {
  position: absolute;
  left: 50%;
  top: 20%;
  z-index: 5;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.7rem;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 6px #fff;
  animation: envol 0.9s ease-out forwards;
}

.flottant.degats {
  color: var(--degats);
}

.flottant.soin {
  color: var(--soin);
}

.flottant.vente {
  color: var(--or-fonce);
  white-space: nowrap;
}

@keyframes envol {
  from { opacity: 1; transform: translate(-50%, 0) scale(1.2); }
  to   { opacity: 0; transform: translate(-50%, -40px) scale(1); }
}

/* ---------- Effets de combat (animations.js) ---------- */

.effets {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.effets > * {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

.balle {
  width: 18px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(245, 189, 60, 0), var(--or-vif) 55%, #fff);
  box-shadow: 0 0 8px rgba(245, 189, 60, 0.9);
}

.roquette {
  width: 24px;
  height: 9px;
  border-radius: 2px 6px 6px 2px;
  background: linear-gradient(90deg, #c9d2dc 0 68%, #e8553f 68%);
  border: 1.5px solid var(--encre);
}

.roquette::after {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 28px;
  height: 6px;
  margin-top: -3px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(245, 154, 60, 0), #f59a3c 70%, #ffe08a);
}

.obus {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8a96a6, #2f3a48 70%);
  border: 1.5px solid var(--encre);
  box-shadow: 0 0 0 3px rgba(245, 189, 60, 0.35);
}

.flamme {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3b0, var(--or-vif) 35%, #f59a3c 58%, rgba(232, 85, 63, 0) 72%);
}

.toxique {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e9ffd0, #8fd14f 55%, #4f8f22);
  border: 1.5px solid var(--encre);
}

.soin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, #7be0a6 45%, rgba(47, 179, 107, 0) 72%);
}

.laser {
  height: 5px;
  margin-top: -2.5px;
  border-radius: 3px;
  transform-origin: 0 50%;
}

.laser-rouge {
  background: linear-gradient(90deg, #ffb3aa, #ff4a3a);
  box-shadow: 0 0 10px #ff4a3a;
}

.laser-cyan {
  background: linear-gradient(90deg, #d4fffa, #2fd8c8);
  box-shadow: 0 0 10px #2fd8c8;
}

.onde {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.onde.feu {
  background: radial-gradient(circle, #fff6c8, var(--or-vif) 40%, rgba(232, 85, 63, 0.6) 62%, rgba(232, 85, 63, 0) 72%);
}

.onde.toxique {
  background: radial-gradient(circle, #f2ffe0, #8fd14f 45%, rgba(79, 143, 34, 0) 72%);
}

.onde.soin {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(47, 179, 107, 0.5) 45%, rgba(47, 179, 107, 0) 72%);
}

.onde.fumee {
  background: radial-gradient(circle, rgba(110, 95, 75, 0.45), rgba(110, 95, 75, 0) 70%);
}

.etincelle {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.etincelle.feu     { background: var(--or-vif); }
.etincelle.toxique { background: #8fd14f; }
.etincelle.soin    { background: var(--soin); border-radius: 50%; }

/* pièce d'une vente qui vole vers l'argent du joueur */
.piece {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 35% 30%, #79a8ff, var(--argent) 60%, #1d47a3);
  border: 2px solid var(--or-vif);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--encre);
}

.effets > .fantome {
  margin: 0;
  transform-origin: 50% 50%;
}

/* tuile qui se fissure puis éclate (animations.js → animerBris) */
.effets > .bris svg {
  display: block;
  overflow: visible;
}

.bris.fissures {
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

/* verre : contour bleu nuit, reflets blancs */
.bris {
  --verre-trait: #1f4a63;
}

.bris.fissures .vitre {
  fill: rgba(200, 236, 250, 0.35);
  stroke: none;
}

.bris.fissures polyline {
  fill: none;
  stroke: var(--verre-trait);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.bris.fissures polyline.reflet {
  stroke: #ffffff;
}

.bris.eclats polygon {
  stroke: var(--verre-trait);
  stroke-linejoin: round;
  transform-box: fill-box;
  transform-origin: center;
}

.bris.eclats polygon.petit {
  fill: rgba(255, 255, 255, 0.92);
}

/* ---------- Tiroir de la boutique ---------- */

.tiroir {
  flex: 0 0 auto;
  background: rgba(255, 253, 248, 0.97);
  border-top: 2px solid var(--or);
  box-shadow: 0 -6px 20px rgba(96, 70, 30, 0.12);
}

.boutique {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 16px 16px 12px 20px; /* place pour la pièce de coût et le survol */
  scrollbar-color: var(--pierre-3) transparent;
}

/* cartes compactes dans la boutique : icône à gauche, nom et stats à droite */
.boutique .carte {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  width: 180px;
  padding: 6px 8px 6px 6px;
}

.boutique .carte-art {
  grid-row: 1 / 3;
  height: 50px;
  font-size: 1.75rem;
}

.boutique .carte-badges {
  top: auto;
  bottom: -6px;
  right: -6px;
}

.boutique .carte-badges span {
  width: 18px;
  height: 18px;
  font-size: 0.62rem;
}

.boutique .carte-nom {
  align-self: end;
  margin: 0;
  font-size: 0.86rem;
  text-align: left;
  overflow-wrap: normal;
}

.boutique .carte-stats {
  align-self: start;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 3px;
}

.boutique .stat {
  font-size: 0.95rem;
}

.boutique .carte-special {
  display: none;
}

.boutique .carte-cout {
  top: -10px;
  left: -10px;
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
}

/* ---------- Barre du bas ---------- */

.barre-jeu {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 70px;
  padding: 0 20px;
  background: rgba(255, 253, 248, 0.97);
  border-top: 2px solid var(--trait);
}

.barre-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pastille-joueur {
  padding: 6px 14px;
  font-family: var(--titre);
  font-weight: 700;
  color: #fff;
  background: var(--j1);
  border-radius: 99px;
}

body[data-actif="1"] .pastille-joueur {
  background: var(--j2);
}

.btn-boutique {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  color: var(--encre);
  background: var(--blanc);
  border: 2px solid var(--or);
  border-radius: 12px;
  box-shadow: var(--ombre);
  cursor: pointer;
}

.btn-boutique:hover,
.btn-boutique.ouvert {
  background: #fff3d6;
}

.btn-boutique:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.barre-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* vendre la carte sélectionnée : visible seulement quand une de tes cartes est choisie */
.btn-vendre {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 18px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  color: var(--blanc);
  background: linear-gradient(180deg, #e2564a, var(--degats));
  border: 2px solid #a8281f;
  border-radius: 12px;
  box-shadow: var(--ombre);
  cursor: pointer;
  animation: apparition-vente 0.18s ease-out;
}

.btn-vendre:hover {
  filter: brightness(1.08);
}

.btn-vendre:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.vente-montant {
  font-family: var(--titre);
  font-weight: 600;
  text-transform: none;
  color: #ffe7a6;
}

@keyframes apparition-vente {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

#fin-tour {
  justify-self: end;
}

/* ---------- Voiles : passage d'écran et victoire ---------- */

.voile {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(60, 45, 20, 0.4);
  backdrop-filter: blur(4px);
}

.panneau-voile {
  --equipe: var(--j1);
  width: min(420px, 100%);
  padding: 30px 28px 28px;
  text-align: center;
  background: var(--blanc);
  border: 2px solid var(--or);
  border-top: 8px solid var(--equipe);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(60, 45, 20, 0.3);
}

.voile[data-joueur="1"] .panneau-voile {
  --equipe: var(--j2);
}

.voile-round {
  font-family: var(--titre);
  font-weight: 600;
  color: var(--or-fonce);
}

.panneau-voile h2 {
  margin: 6px 0 16px;
  font-size: 2rem;
  color: var(--equipe);
}

.passage-evenements {
  margin-bottom: 22px;
  padding: 0;
  list-style: none;
  font-weight: 700;
  color: var(--encre);
}

.passage-evenements li {
  padding: 5px 0;
  border-bottom: 1px solid var(--trait);
}

/* ---------- Room (partie en ligne) ---------- */
.room-panneau {
  width: min(440px, 100%);
}

.room-attente,
.room-form {
  display: grid;
  gap: 12px;
  justify-items: center;
}

/* étape 1 : deux gros boutons côte à côte */
.room-accueil {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.room-gros-bouton {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 10px 16px;
  font: inherit;
  color: var(--encre);
  background: var(--creme);
  border: 2px solid var(--trait);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.room-gros-bouton:hover {
  background: #fff3d6;
  border-color: var(--or);
  transform: translateY(-2px);
}

.room-gros-bouton:focus-visible {
  outline: 3px solid var(--or-vif);
  outline-offset: 2px;
}

.room-logo {
  width: 64px;
  height: 64px;
}

.room-gros-titre {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
}

.room-gros-texte {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--encre-2);
}

.room-form-titre {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.15rem;
}

.room-champ[hidden] {
  display: none;
}

.room-code-saisie {
  font-family: var(--titre);
  letter-spacing: 0.25em;
  text-align: center;
  text-transform: uppercase;
}

.room-champ {
  display: grid;
  gap: 6px;
  width: 100%;
  font-weight: 700;
  text-align: left;
}

.room-champ input {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--encre);
  background: var(--creme);
  border: 2px solid var(--trait);
  border-radius: 12px;
}

.room-champ input:focus-visible {
  outline: 3px solid var(--or-vif);
  outline-offset: 1px;
  border-color: var(--or);
}

.room-code-affiche {
  padding: 6px 18px;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 2.4rem;
  letter-spacing: 0.2em;
  color: var(--encre);
  background: var(--creme);
  border: 2px dashed var(--or);
  border-radius: 14px;
  user-select: all;
}

.room-statut {
  font-weight: 700;
  color: var(--encre-2);
  animation: room-attente 1.4s ease-in-out infinite;
}

@keyframes room-attente {
  50% { opacity: 0.45; }
}

.room-erreur {
  min-height: 1.4em;
  margin-top: 10px;
  font-weight: 700;
  color: var(--degats);
}

.room-lien {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 8px;
  font: inherit;
  font-weight: 700;
  color: var(--encre-2);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

.room-lien:hover {
  color: var(--encre);
}

/* adversaire déconnecté / connexion perdue */
.bandeau-reseau {
  position: fixed;
  top: 64px;
  left: 50%;
  z-index: 25;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  font-weight: 700;
  color: var(--blanc);
  background: var(--degats);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(60, 20, 10, 0.3);
  transform: translateX(-50%);
}

.victoire-revanche {
  min-height: 1.4em;
  margin: -6px 0 14px;
  font-weight: 700;
  color: var(--encre-2);
}

/* en ligne, chacun se voit en bas : si je suis le Joueur 2, l'arène est retournée */
body.vue-inversee .arene {
  flex-direction: column-reverse;
}

@media (prefers-reduced-motion: reduce) {
  .room-statut {
    animation: none;
  }
}

/* ---------- Mort subite ---------- */
.passage-evenements .evenement-mort-subite {
  color: var(--degats);
}

/* le compteur de round passe au rouge pendant la mort subite */
body.mort-subite .plaque-tour {
  color: var(--blanc);
  background: var(--degats);
  border-color: #8f1f17;
}

.voile-mort-subite {
  z-index: 30;
  background: radial-gradient(circle at 50% 50%, rgba(120, 20, 12, 0.55), rgba(40, 8, 4, 0.82));
  backdrop-filter: blur(3px);
  animation: voile-mort-subite 2.6s ease-in-out both;
}

.mort-subite-annonce {
  max-width: 560px;
  text-align: center;
}

.mort-subite-titre {
  font-family: var(--titre);
  font-weight: 700;
  font-size: clamp(3rem, 13vw, 7rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffe9e4;
  text-shadow: 0 0 2px #5a0f08, 0 4px 0 #8f1f17, 0 0 40px rgba(255, 80, 50, 0.8);
  animation: tampon-mort-subite 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) both, tremble-mort-subite 0.4s 0.55s linear 2;
}

.mort-subite-texte {
  margin-top: 18px;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.5;
  color: #ffe9e4;
  animation: texte-mort-subite 0.4s 0.6s ease-out both;
}

@keyframes voile-mort-subite {
  0% { opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes tampon-mort-subite {
  from {
    opacity: 0;
    transform: scale(2.6) rotate(-6deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(-3deg);
  }
}

@keyframes tremble-mort-subite {
  0%, 100% { transform: scale(1) rotate(-3deg) translateX(0); }
  25% { transform: scale(1) rotate(-3deg) translateX(-6px); }
  75% { transform: scale(1) rotate(-3deg) translateX(6px); }
}

@keyframes texte-mort-subite {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .voile-mort-subite,
  .mort-subite-titre,
  .mort-subite-texte {
    animation: none;
  }
}

.voile-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Pile ou face (début de partie) ---------- */

/* tant que la pièce tourne, le panneau reste neutre (or) ; il prend la couleur du gagnant ensuite */
.voile-piece:not([data-joueur]) .panneau-voile {
  --equipe: var(--or-vif);
}

.voile-piece:not([data-joueur]) h2 {
  color: var(--encre-2);
}

.piece-scene {
  position: relative;
  display: grid;
  place-items: center;
  height: 190px;
  margin-top: 8px;
  perspective: 700px;
}

.piece-flip {
  position: relative;
  width: 124px;
  height: 124px;
  transform-style: preserve-3d;
}

.piece-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 6px solid var(--or-vif);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55), 0 6px 14px rgba(60, 45, 20, 0.25);
  backface-visibility: hidden;
}

.piece-face .art {
  width: 70%;
  height: 70%;
}

.piece-face.bleu {
  --art: #3aa6c4;
  --art-fonce: #1f7f9a;
  background: radial-gradient(circle at 35% 30%, #e3f6fb, var(--j1-clair) 45%, #7cc3d6);
}

.piece-face.rouge {
  --art: #e76050;
  --art-fonce: #b8412f;
  background: radial-gradient(circle at 35% 30%, #fff0ed, var(--j2-clair) 45%, #eb9a8e);
  transform: rotateY(180deg);
}

/* ombre au sol, sous la pièce */
.piece-ombre {
  position: absolute;
  bottom: 14px;
  width: 96px;
  height: 14px;
  background: radial-gradient(ellipse, rgba(60, 45, 20, 0.28), transparent 70%);
  pointer-events: none;
}

.voile-piece[data-joueur] h2 {
  animation: resultat-piece 0.35s ease-out;
}

@keyframes resultat-piece {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}

/* =========================================================
   Écran étroit
   ========================================================= */

@media (max-width: 1100px) {
  .fiche {
    display: none;
  }
}

@media (min-width: 1101px) {
  .ruche {
    --reserve: 400px;
  }
}

@media (max-width: 900px) {
  .client-barre {
    flex-wrap: wrap;
    height: auto;
    gap: 12px 20px;
    padding: 12px 16px 0;
  }
  .onglets {
    order: 3;
    width: 100%;
    height: 44px;
    overflow-x: auto;
  }
  .profil-statut,
  .profil-nom {
    display: none;
  }
  .accueil {
    grid-template-columns: minmax(0, 1fr);
  }
  .menu-lateral {
    display: none;
  }
  .vitrine {
    padding: 36px 16px 0;
  }
  .banniere {
    padding: 24px 16px;
  }
  .modes {
    padding: 24px 16px;
  }
  .modes-liste {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page {
    padding: 32px 16px;
  }
}

@media (max-width: 640px) {
  .banniere {
    flex-direction: column;
    align-items: flex-start;
  }
  .carte-vedette {
    align-self: center;
    margin: 0;
  }
  .jeu-barre {
    padding: 0 12px;
  }
  .jeu-mode,
  .jeu-droite .version {
    display: none;
  }
  .jeu-barre {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }
  .jeu-centre {
    justify-self: center;
  }
  .plaque-tour {
    padding: 5px 14px;
  }
  .base-bandeau {
    grid-template-columns: auto minmax(40px, 1fr) auto auto;
    gap: 8px;
  }
  .base-nom {
    display: none;
  }
  .barre-jeu {
    grid-template-columns: auto auto 1fr;
    gap: 8px;
    padding: 0 12px;
  }
  .pastille-joueur {
    display: none;
  }
  .btn-boutique {
    padding: 0 12px;
  }
  .btn-vendre {
    padding: 0 10px;
    font-size: 0.9rem;
  }
  .barre-actions {
    gap: 6px;
  }
  #fin-tour {
    --fleche: 12px;
    padding: 0 26px 0 14px;
    font-size: 0.9rem;
  }
  .consigne {
    font-size: 0.82rem;
    padding: 6px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* téléphone étroit : les modes sur une seule colonne (les grands titres ne tiennent pas sur deux) */
@media (max-width: 420px) {
  .modes-liste {
    grid-template-columns: minmax(0, 1fr);
  }
}
