/* ==========================================================================
   Smile Life — direction « autocollants »
   Encre indigo, ciel pâle, jaune smiley. Les cartes sont des autocollants :
   contour épais et ombre portée nette. Texte en Atkinson Hyperlegible,
   dessinée par le Braille Institute pour la lisibilité.
   ========================================================================== */

:root {
  --bg: #e6ebfa;
  --surface: #ffffff;
  --surface-2: #f1f4fd;
  --text: #1e1b3a;
  --muted: #4e4a6b;
  --line: #1e1b3a;
  --drop: #1e1b3a;
  --border: #c9d1ee;
  --sun: #ffc93c;
  --sun-soft: #fff1c7;
  --ink: #1e1b3a;
  --accent: #c2185b;
  --accent-text: #ffffff;
  --focus: #0b57d0;

  --c-pro: #2f5bd3;   --t-pro: #e6edff;
  --c-perso: #b81d5b; --t-perso: #fde6ef;
  --c-acq: #1b7f5c;   --t-acq: #ddf5ea;
  --c-malus: #c62828; --t-malus: #fde3e3;
  --c-special: #9a5b00; --t-special: #fff0d6;
  --c-dist: #6d3fd1;  --t-dist: #eee7fd;
  --head-text: #ffffff;

  /* Formes */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 12px;
  --radius: 14px;   /* cartes */
  --r-lg: 16px;     /* panneaux */
  --r-pill: 999px;
  --bw: 2.5px;      /* contour autocollant */
  --bw-2: 2px;
  --bw-thin: 1.5px;
  /* Ombres portées nettes (hauteur d'autocollant) */
  --lift-1: 2px 2px 0 var(--drop);
  --lift-2: 3px 3px 0 var(--drop);
  --lift-3: 4px 4px 0 var(--drop);
  --c-pro-2: #4a74e6;
  /* Espacements (écarts entre éléments) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  /* Échelle typographique : six tailles, pas une de plus */
  --fs-xs: .66rem;    /* étiquettes de carte, pastilles */
  --fs-sm: .78rem;    /* statistiques, petites étiquettes */
  --fs-md: .92rem;    /* texte secondaire, journal, boutons discrets */
  --fs-base: 1.02rem; /* texte courant, sous-titres */
  --fs-lg: 1.4rem;    /* titres, consigne du tour */
  --fs-xl: clamp(2.2rem, 6vw, 2.8rem); /* affichage : accueil, code du salon */
  --avatar-text: #ffffff;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-title: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13122a;
    --surface: #1f1d3d;
    --surface-2: #2a2850;
    --text: #f1efff;
    --muted: #bcb8df;
    --line: #e9e6ff;
    --drop: #000000;
    --border: #3a3766;
    --sun-soft: #3b3314;
    --accent: #ff7aa8;
    --accent-text: #1e1b3a;
    --focus: #8ab4f8;
    --c-pro: #8caeff;   --t-pro: #1e2b57;
    --c-perso: #ff8fb8; --t-perso: #4a1c33;
    --c-acq: #6fe0b0;   --t-acq: #173d30;
    --c-malus: #ff8a8a; --t-malus: #4a1c1c;
    --c-special: #ffc266; --t-special: #45310e;
    --c-dist: #bfa5ff;  --t-dist: #2f2458;
    --head-text: #1e1b3a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/1.5 var(--font-body);
}

h2, h3 { font-family: var(--font-title); font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: var(--fs-lg); margin: 0 0 10px; }
h3 { font-size: var(--fs-base); margin: 0 0 8px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 20; border: var(--bw-2) solid var(--line); border-radius: var(--r-sm); }

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

/* --------------------------------------------------------------------------
   Smiley dessiné (logo, score, pioche)
   -------------------------------------------------------------------------- */
.face {
  --s: 30px;
  position: relative; display: inline-block; flex: none;
  width: var(--s); height: var(--s); border-radius: 50%;
  background: var(--sun); border: var(--bw-2) solid var(--ink);
}
.face::before {
  content: ""; position: absolute;
  width: calc(var(--s) * .13); height: calc(var(--s) * .18);
  top: calc(var(--s) * .26); left: calc(var(--s) * .27);
  background: var(--ink); border-radius: 50%;
  box-shadow: calc(var(--s) * .3) 0 0 var(--ink);
}
.face::after {
  content: ""; position: absolute;
  left: 24%; width: 52%; top: 44%; height: 26%;
  border-bottom: calc(var(--s) * .08) solid var(--ink);
  border-radius: 0 0 999px 999px;
}
.face.big { --s: 46px; border-width: 3px; }

/* --------------------------------------------------------------------------
   Boutons et champs : des autocollants qu'on enfonce
   -------------------------------------------------------------------------- */
button {
  font: inherit; font-weight: 700; cursor: pointer;
  border: var(--bw) solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  padding: 8px 16px; min-height: 44px;
  box-shadow: var(--lift-2);
  transition: transform .08s ease, box-shadow .08s ease;
}
button:hover { transform: translate(-1px, -1px); box-shadow: var(--lift-3); }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--drop); }
button.primary { background: var(--sun); color: var(--ink); }
button.danger { background: var(--accent); color: var(--accent-text); }

input, select {
  font: inherit; min-height: 44px; min-width: 0;
  padding: 8px 12px; border: var(--bw) solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
}
select { min-height: 44px; padding: 4px 10px; }

.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }

.panel {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--lift-3); min-width: 0;
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: 10px 20px; background: var(--surface); border-bottom: var(--bw) solid var(--line);
}
.logo {
  margin: 0; display: flex; align-items: center; gap: var(--sp-3); white-space: nowrap;
  font: 800 var(--fs-lg)/1 var(--font-title); letter-spacing: -.02em;
}
.conn { margin: 0; color: var(--muted); font-size: var(--fs-md); }

main { padding: 20px 16px; max-width: 1360px; margin: 0 auto; }

/* --------------------------------------------------------------------------
   Accueil et salon
   -------------------------------------------------------------------------- */
.hero { text-align: center; padding: 28px 16px; }
.hero h2 { font-size: var(--fs-xl); line-height: 1.05; margin-bottom: 12px; letter-spacing: -.03em; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto; font-size: var(--fs-base); }
.home-grid { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 820px; margin: 0 auto; }
.home-grid .panel { display: flex; flex-direction: column; gap: var(--sp-3); }
.home-grid .panel p { margin: 0; }
.code-input { text-transform: uppercase; letter-spacing: .3em; width: 10ch; font-weight: 700; }

.room-panel { max-width: 560px; margin: 24px auto; }
.room-code {
  width: fit-content; margin: 8px auto 12px; padding: 4px 18px 4px 26px;
  font: 800 var(--fs-xl)/1.2 var(--font-title); letter-spacing: .3em;
  background: var(--sun); color: var(--ink);
  border: var(--bw) solid var(--line); border-radius: var(--radius); box-shadow: var(--lift-3);
  rotate: -1.5deg;
}
.members { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: var(--sp-2); }
.members li {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); border: var(--bw-2) solid var(--border);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font: 800 var(--fs-base) var(--font-title); color: var(--avatar-text); border: var(--bw-2) solid var(--line);
}
.members .who { flex: 1; min-width: 0; font-weight: 700; }
.tag { font-size: var(--fs-sm); font-weight: 700; padding: 1px 9px; border-radius: var(--r-pill); background: var(--surface); border: var(--bw-thin) solid var(--line); }

/* --------------------------------------------------------------------------
   Table de jeu
   -------------------------------------------------------------------------- */
.jump { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); font-size: var(--fs-md); }
.jump:not(:focus-within) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.jump:focus-within { margin: 0 0 14px; padding: 8px 12px; background: var(--surface); border: var(--bw-2) solid var(--line); border-radius: var(--r-md); }
.jump a { color: var(--text); font-weight: 700; display: inline-block; padding: 4px 2px; min-height: 24px; }

.table { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) {
  .table { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .table-side { position: sticky; top: 14px; }
}
.table-main, .table-side { display: grid; gap: var(--sp-5); min-width: 0; }

/* Bandeau de tour */
.banner {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg);
  padding: 14px 18px; box-shadow: var(--lift-3);
}
.banner h2 {
  display: inline-block; font: 700 var(--fs-sm)/1 var(--font-body); text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin: 0 0 8px;
}
.prompt { font: 800 var(--fs-lg)/1.25 var(--font-title); margin: 0 0 12px; letter-spacing: -.01em; }
.my-turn .banner { background: var(--sun-soft); }
.my-turn .banner h2 {
  color: var(--ink); background: var(--sun); padding: 4px 10px; border-radius: var(--r-pill); border: var(--bw-2) solid var(--line);
}
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.actions:empty { display: none; }
.actions .full { width: 100%; }
.ranking { margin: 0; padding-left: 24px; font-size: var(--fs-base); }
.ranking li:first-child { font-weight: 700; }
button.quiet { min-height: 44px; padding: 4px 14px; font-size: var(--fs-md); box-shadow: var(--lift-1); }
.speed { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: var(--fs-md); font-weight: 700; }
.speed[hidden] { display: none; }

/* Main : les cartes en éventail */
.hand-zone { padding: 4px 2px; }
.hand-zone h2 { margin-bottom: 6px; }
.hand { list-style: none; margin: 0; padding: 12px 4px 8px; display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.hand-btn {
  padding: 0; border: 0; border-radius: var(--radius); background: none; min-height: 0; box-shadow: none;
  transition: transform .15s ease, rotate .15s ease;
}
.hand li:nth-child(4n + 1) .hand-btn { rotate: -2deg; }
.hand li:nth-child(4n + 2) .hand-btn { rotate: 1.2deg; }
.hand li:nth-child(4n + 3) .hand-btn { rotate: -.8deg; }
.hand li:nth-child(4n) .hand-btn { rotate: 2deg; }
.hand .hand-btn:hover { rotate: 0deg; transform: translateY(-6px); box-shadow: none; }
.hand .hand-btn[aria-expanded="true"] { rotate: 0deg; transform: translateY(-12px); }
.hand-btn[aria-expanded="true"] .cf { box-shadow: 0 0 0 4px var(--sun), 6px 6px 0 var(--drop); }
.hand-btn:active { box-shadow: none; }
/* Seuls l'illustration et le bandeau pâlissent : le texte garde tout son contraste. */
.hand-btn.dim .cf-head, .hand-btn.dim .cf-art { opacity: .4; filter: grayscale(.8); }
.hand-btn.dim .cf { border-style: dashed; box-shadow: 2px 2px 0 var(--border); }
.hand-btn.dim { position: relative; }
.hand-btn.dim::after {
  content: "Injouable"; position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: var(--fs-xs); font-weight: 700;
  padding: 1px 9px; border-radius: var(--r-pill); letter-spacing: .04em; text-transform: uppercase;
}
.hand-btn.dim:hover::after, .hand-btn.dim[aria-expanded="true"]::after { display: none; }
.hand-btn.dim:hover :is(.cf-head, .cf-art), .hand-btn.dim[aria-expanded="true"] :is(.cf-head, .cf-art) { opacity: 1; filter: none; }

#card-panel:empty { display: none; }
.card-panel {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: var(--bw) solid var(--line); box-shadow: 4px 4px 0 var(--sun);
}
.card-panel h3 { margin-bottom: 4px; }
.card-panel .info { margin: 0 0 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Cartes autocollants
   -------------------------------------------------------------------------- */
.cf {
  --c: var(--c-pro); --t: var(--t-pro);
  width: 136px; min-height: 192px; border-radius: var(--radius);
  background: var(--surface); border: var(--bw) solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; position: relative;
  box-shadow: var(--lift-3); text-align: center; color: var(--text);
}
.cf-head {
  background: var(--c); color: var(--head-text); border-bottom: var(--bw) solid var(--line);
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 5px 6px 5px 9px; min-height: 30px;
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-1);
}
/* Le libellé cède la place à la pastille de smiles, jamais l'inverse. */
.cf-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-smile {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px;
  background: var(--sun); color: var(--ink); border: var(--bw-2) solid var(--ink); border-radius: 50%;
  font: 800 var(--fs-sm)/1 var(--font-title); letter-spacing: 0;
}
.cf-art {
  flex: 1; display: grid; place-items: center; font-size: 2.6rem; line-height: 1;
  background: var(--t); margin: 7px; border-radius: var(--r-sm);
  border: var(--bw-2) solid color-mix(in srgb, var(--c) 35%, transparent);
}
.cf-name { font: 800 var(--fs-base)/1.1 var(--font-title); padding: 0 6px; letter-spacing: -.01em; hyphens: auto; overflow-wrap: break-word; }
.cf-stats { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); padding: 3px 6px 7px; min-height: 1.5em; }
.cf-stats.long {
  font-size: var(--fs-xs); font-weight: 400; line-height: 1.2; text-align: left;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.6em;
}
.cf-status {
  position: absolute; top: 36px; right: 11px; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  background: var(--surface); color: var(--text); border: var(--bw-thin) solid var(--line); border-radius: var(--r-xs); padding: 0 4px;
}
.cf--small { width: 104px; min-height: 148px; box-shadow: var(--lift-2); }
.cf--small .cf-art { font-size: 1.9rem; margin: 5px; }
.cf--small .cf-name { font-size: var(--fs-md); }
.cf--small .cf-stats.long { -webkit-line-clamp: 2; min-height: 2.4em; }

.cat-etudes, .cat-metier, .cat-salaire { --c: var(--c-pro); --t: var(--t-pro); }
.cat-flirt, .cat-mariage, .cat-adultere, .cat-enfant { --c: var(--c-perso); --t: var(--t-perso); }
.cat-animal, .cat-voyage, .cat-maison { --c: var(--c-acq); --t: var(--t-acq); }
.cat-malus { --c: var(--c-malus); --t: var(--t-malus); }
.cat-speciale { --c: var(--c-special); --t: var(--t-special); }
.cat-distinction { --c: var(--c-dist); --t: var(--t-dist); }

/* Dos de carte (pioche) : rayons de soleil autour d'un smiley */
.cb {
  width: 104px; height: 148px; border-radius: var(--radius);
  display: grid; place-items: center;
  background: repeating-conic-gradient(from 0deg, var(--c-pro) 0deg 15deg, var(--c-pro-2) 15deg 30deg);
  border: var(--bw) solid var(--line); box-shadow: var(--lift-2);
}
.cb.empty { background: var(--surface-2); border-style: dashed; color: var(--muted); font-size: var(--fs-md); box-shadow: none; }

/* Mini-cartes des plateaux */
/* Pas de couleur par défaut ici : elle viendrait écraser celle de la famille (.cat-*). */
.mc {
  display: inline-flex; align-items: center; gap: var(--sp-1); max-width: 100%; min-width: 0;
  padding: 3px 8px 3px 6px; border-radius: var(--r-sm); font-size: var(--fs-md); font-weight: 700;
  background: var(--t); border: var(--bw-thin) solid var(--line); border-left: 6px solid var(--c);
}
.mc .tx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mc .ic { flex: none; font-size: 1rem; }
.mc .mc-smile {
  flex: none; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px;
  background: var(--sun); color: var(--ink); border: var(--bw-thin) solid var(--ink); border-radius: var(--r-pill);
  font: 800 var(--fs-xs)/1 var(--font-title);
}
/* Inactive : seuls l'icône et la pastille pâlissent, le texte barré garde son contraste. */
.mc.off { border-style: dashed; border-left-style: solid; text-decoration: line-through; }
.mc.off :is(.ic, .mc-smile) { opacity: .45; filter: grayscale(.8); }
.mc.big { font-size: var(--fs-md); padding: 5px 10px 5px 7px; }

/* --------------------------------------------------------------------------
   Plateaux des joueurs
   -------------------------------------------------------------------------- */
.boards { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.board {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg);
  padding: 12px 14px; box-shadow: var(--lift-3); min-width: 0;
}
.board.me { grid-column: 1 / -1; }
.board.current { background: var(--sun-soft); box-shadow: var(--lift-3), 0 0 0 4px var(--sun); }
.board-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: 8px; }
.board-head h3 { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score {
  display: inline-flex; align-items: center; gap: var(--sp-2); flex: none;
  font: 800 var(--fs-base)/1 var(--font-title); color: var(--ink);
  background: var(--sun); border: var(--bw) solid var(--line); border-radius: var(--r-pill);
  padding: 3px 12px 3px 3px; box-shadow: var(--lift-1);
}
.score .face { --s: 24px; border-width: 1.5px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: 10px; }
.chip { font-size: var(--fs-sm); font-weight: 700; padding: 1px 9px; border-radius: var(--r-pill); background: var(--surface-2); border: var(--bw-thin) solid var(--border); }
.chip.warn { background: var(--t-malus); color: var(--c-malus); border-color: currentColor; }
.chip.turn { background: var(--ink); color: var(--sun); border-color: var(--ink); }
.zones { display: grid; gap: var(--sp-2); margin: 0; }
.zone-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--sp-2); align-items: start; }
.zone-row dt { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding-top: 6px; }
.zone-row dd { margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.zone-row .none { color: var(--muted); padding-top: 3px; font-weight: 700; }

/* --------------------------------------------------------------------------
   Colonne latérale
   -------------------------------------------------------------------------- */
.piles { display: flex; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.pile { display: grid; gap: var(--sp-2); justify-items: center; font-size: var(--fs-md); font-weight: 700; color: var(--muted); }
.casino {
  margin-top: 12px; padding: 8px 12px; border-radius: var(--r-md); background: var(--t-special);
  border: var(--bw-thin) solid var(--line); border-left: 6px solid var(--c-special); font-size: var(--fs-md);
}
details { margin-top: 12px; font-size: var(--fs-md); }
summary { cursor: pointer; font-weight: 700; }
details ol { max-height: 200px; overflow-y: auto; padding-left: 22px; }

.log { margin: 0; padding: 0; list-style: none; max-height: 300px; overflow-y: auto; font-size: var(--fs-md); display: grid; gap: var(--sp-1); }
.log li { padding: 4px 8px; border-radius: var(--r-sm); }
.log li:nth-child(odd) { background: var(--surface-2); }
.log li.turn-line {
  font: 800 var(--fs-md) var(--font-title); background: transparent;
  border-top: var(--bw-2) dashed var(--border); border-radius: 0; margin-top: 6px; padding-top: 8px;
}
.chat { max-height: 180px; margin-bottom: 10px; }
#form-chat input { flex: 1; }

/* --------------------------------------------------------------------------
   Mouvement réduit et petits écrans
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .hand .hand-btn, .room-code { rotate: 0deg !important; }
}
@media (max-width: 520px) {
  main { padding: 14px 12px; }
  .top { padding: 8px 12px; }
  .logo { font-size: var(--fs-base); }
  .logo .face { --s: 24px; }
  .hand { gap: var(--sp-3); }
  .cf { width: 98px; min-height: 142px; --fs-xs: .56rem; }
  .cf-head { font-size: var(--fs-xs); padding: 3px 4px 3px 6px; min-height: 24px; letter-spacing: .03em; }
  .cf-smile { width: 18px; height: 18px; font-size: var(--fs-xs); }
  .cf-art { font-size: 1.6rem; margin: 4px; }
  .cf-name { font-size: var(--fs-sm); }
  .cf-stats { font-size: var(--fs-xs); padding-bottom: 4px; }
  .cf-stats.long { -webkit-line-clamp: 2; min-height: 2.4em; font-size: var(--fs-xs); }
  .cf-status { top: 27px; right: 7px; font-size: var(--fs-xs); }
  .zone-row { grid-template-columns: 58px minmax(0, 1fr); gap: var(--sp-2); }
  .zone-row dt { font-size: var(--fs-xs); }
  .boards { grid-template-columns: 1fr; }
}

/* Pioche et défausse côte à côte dans la colonne latérale */
.pile { max-width: 128px; text-align: center; }

/* Tableau des scores (visuel) */
.scoreboard { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.sb {
  display: flex; align-items: center; gap: var(--sp-2); padding: 4px 12px 4px 4px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-pill);
  box-shadow: var(--lift-1); font-weight: 700;
}
.sb .avatar { width: 30px; height: 30px; font-size: var(--fs-md); }
.sb-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-score { display: inline-flex; align-items: center; gap: var(--sp-1); font: 800 var(--fs-base)/1 var(--font-title); }
.sb-score .face { --s: 20px; border-width: 1.5px; }
.sb.current { background: var(--sun); color: var(--ink); }
.sb-turn {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em;
  background: var(--ink); color: var(--sun); border-radius: var(--r-pill); padding: 1px 8px;
}
.sb.lead .sb-score::after { content: "👑"; font-size: .9rem; margin-left: 2px; }

/* Salon : le nom garde sa place, les étiquettes et le bouton passent dessous si besoin */
.members .who { flex: 1 1 10ch; }

#speed-room { margin-top: 14px; }

@media (max-width: 520px) {
  /* Tableau des scores : une seule ligne qui défile */
  .scoreboard { flex-wrap: nowrap; overflow-x: auto; padding: 2px 4px 6px 2px; scrollbar-width: none; }
  .sb { flex: none; gap: var(--sp-2); padding: 3px 10px 3px 3px; font-size: var(--fs-md); }
  .sb .avatar { width: 26px; height: 26px; font-size: var(--fs-sm); }
  .sb-name { max-width: 12ch; }
  .sb-turn { font-size: var(--fs-xs); padding: 1px 6px; }
  .cf-stats:not(.long) { white-space: nowrap; }
}

/* Étiquette « Injouable » posée sur l'illustration, jamais sur le nom */
.hand-btn.dim::after { top: 42%; bottom: auto; }

/* Sons */
.top-right { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; justify-content: flex-end; }
.sound-ctl { display: flex; align-items: center; gap: var(--sp-2); }
.sound-ctl button { min-height: 44px; padding: 4px 12px; }
.sound-ctl input[type="range"] {
  width: 110px; min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--c-pro);
}
.sound-ctl input[type="range"]:disabled { opacity: .4; }
.sounds-panel { max-width: 820px; margin: 20px auto 0; }
.sounds-panel summary { font: 800 var(--fs-base) var(--font-title); }
.sound-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.sound-list button { min-height: 44px; padding: 4px 12px; font-size: var(--fs-md); box-shadow: var(--lift-1); }
@media (max-width: 520px) {
  .conn { display: none; }
  .sound-ctl input[type="range"] { width: 80px; }
}

/* Raccourcis clavier */
.keys-help { margin-top: 14px; padding: 14px 16px; background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--lift-2); }
.keys-help[hidden] { display: none; }
.keys-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-4); margin: 8px 0 0; align-items: baseline; }
.keys-list dt { margin: 0; }
.keys-list dd { margin: 0; }
kbd {
  font: 700 var(--fs-sm) var(--font-body); white-space: nowrap;
  background: var(--surface); color: var(--text);
  border: var(--bw-thin) solid var(--line); border-bottom-width: 3px; border-radius: var(--r-xs); padding: 1px 6px;
}
@media (max-width: 520px) { .keys-list { grid-template-columns: 1fr; gap: var(--sp-1); } .keys-list dd { margin-bottom: 6px; } }

/* Réglage des raccourcis à une touche */
.keys-toggle { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; font-weight: 700; cursor: pointer; }
.keys-toggle input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--c-pro); }

/* Erreur liée à un champ */
input[aria-invalid="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.field-error { margin: 0; color: var(--c-malus); font-weight: 700; font-size: var(--fs-md); }
.field-error::before { content: "⚠ "; }
.field-error[hidden] { display: none; }

/* Message visible (retour des annonces parlées) */
.notice {
  position: fixed; z-index: 30; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 12px 12px 12px 16px; background: var(--surface); color: var(--text);
  border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--lift-3), 0 0 0 4px var(--sun);
}
.notice[hidden] { display: none; }
.notice p { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; max-height: 40vh; overflow-y: auto; }
.notice button { flex: none; }
@media (max-width: 520px) {
  .notice { flex-direction: column; align-items: stretch; gap: var(--sp-2); bottom: 12px; width: calc(100% - 24px); font-size: var(--fs-md); padding: 10px 12px; }
  .notice p { max-height: 30vh; }
  .notice button { align-self: flex-end; }
}

/* Carte qui vient d'arriver sur un plateau */
.mc.arrive { animation: arrive .25s ease-out, arrive-ring 1.6s ease-out; }
@keyframes arrive { from { transform: translateY(-8px) scale(.7); opacity: 0; } }
@keyframes arrive-ring { from { box-shadow: 0 0 0 4px var(--sun); } }
@media (prefers-reduced-motion: reduce) {
  /* Pas de mouvement, seulement l'anneau qui s'estompe. */
  .mc.arrive { animation: arrive-ring 1.6s ease-out; }
}

/* Ligne « Dernier coup » du bandeau */
.prompt:has(+ .last-move:not([hidden])) { margin-bottom: 6px; }
.last-move { margin: 0 0 12px; font-size: var(--fs-md); line-height: 1.7; color: var(--muted); }
.last-move[hidden] { display: none; }
.last-move strong { color: var(--text); }
.last-move .mc { font-size: var(--fs-sm); vertical-align: middle; margin-inline: 2px; }

/* Actions : la carte de la défausse dans son bouton, les actions coûteuses à part */
button.with-card { display: inline-flex; align-items: center; gap: var(--sp-2); text-align: left; }
button.with-card .mc { font-size: var(--fs-sm); padding-block: 1px; }

/* Outils, sous la main */
.tools-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }

/* Légende des statistiques de la main */
.hand-legend { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.hand-legend[hidden] { display: none; }

/* Zones vides regroupées sur une ligne */
.zone-row.empty { display: flex; align-items: baseline; gap: var(--sp-2); }
.zone-row.empty dt { padding-top: 0; }

/* Pioche et défausse cliquables quand l'action est possible (doublon souris des boutons) */
.pile.can { cursor: pointer; }
.pile.can :is(.cb, .cf) { transition: transform .08s ease, box-shadow .08s ease; box-shadow: var(--lift-2), 0 0 0 3px var(--sun); }
.pile.can:hover :is(.cb, .cf) { transform: translate(-1px, -1px); box-shadow: var(--lift-3), 0 0 0 3px var(--sun); }

@media (max-width: 520px) {
  /* Le fond jaune dit déjà qui joue : on garde la place pour les noms. */
  .sb-turn { display: none; }
}
