/* Mauvais Goût en ligne. DA reprise de reference/mauvais-gout-solo.html :
   des cartes posées sur une nappe vichy, une colonne, l'action principale en bas sous le pouce. */
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --nappe: #ffffff;
  --carreau: rgb(204 38 52 / .30);
  --panel: #ffffff;
  --fg: #1e1415;
  --muted: #7a5f62;
  --line: #ecdadc;
  --accent: #c81f30;
  --accent-ink: #ffffff;
  --noire: #000000;
  --noire-bord: transparent;
  --blanche: #ffffff;
  --blanche-ink: #000000;
  --ombre: rgb(90 12 20 / .16);
  --voile: rgb(30 10 12 / .45);
  --f-carte: "Archivo", sans-serif;
  --f-ui: "Archivo", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nappe: #170e10; --carreau: rgb(160 28 44 / .26); --panel: #231719; --fg: #f5eced;
    --muted: #b79c9f; --line: #3b2a2d; --accent: #ef4655; --accent-ink: #170e10;
    --noire: #000000; --noire-bord: #3a2a2d; --blanche: #f8f4f4; --blanche-ink: #000000;
    --ombre: rgb(0 0 0 / .5); --voile: rgb(0 0 0 / .6); color-scheme: dark;
  }
}

html { height: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--nappe);
  background-image:
    linear-gradient(90deg, var(--carreau) 50%, transparent 50%),
    linear-gradient(var(--carreau) 50%, transparent 50%);
  background-size: 48px 48px;
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  /* Les cartes penchées ne doivent jamais élargir la page. */
  overflow-x: clip;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.app {
  max-width: 540px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(16px, env(safe-area-inset-top, 0px)) 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* En-tête */
.tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marque {
  margin: 0;
  background: var(--noire); color: #fff; border: 1px solid var(--noire-bord);
  font-family: var(--f-carte); font-weight: 900; font-stretch: 70%;
  font-size: 22px; letter-spacing: -.01em; line-height: 1;
  padding: 9px 12px 8px; border-radius: 8px; transform: rotate(-2deg);
  box-shadow: 0 6px 16px var(--ombre);
}
.marque.grande { font-size: clamp(40px, 12vw, 58px); padding: 14px 18px 12px; border-radius: 12px; }
.pastille {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px;
  transform: rotate(10deg); box-shadow: 0 4px 10px var(--ombre); flex: none;
}
.lien-tete {
  background: var(--panel); border: 0; border-radius: 999px; padding: 0 16px; min-height: 44px;
  font-weight: 700; font-size: 15px; box-shadow: 0 3px 10px var(--ombre);
}

/* Cartes */
.carte {
  border-radius: 14px; padding: 18px 18px 14px;
  font-family: var(--f-carte); font-weight: 700; font-stretch: 92%;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  box-shadow: 0 1px 0 rgb(0 0 0 / .06), 0 10px 26px var(--ombre);
  overflow-wrap: anywhere; text-align: left;
}
.carte .corps { display: block; }
.carte.noire { background: var(--noire); color: #fff; border: 1px solid var(--noire-bord); font-size: clamp(21px, 5.8vw, 27px); line-height: 1.22; min-height: 200px; }
.carte.noire.compacte { font-size: 18px; min-height: 0; padding: 14px 16px 12px; }
.carte.blanche { background: var(--blanche); color: var(--blanche-ink); font-size: 16.5px; line-height: 1.25; min-height: 132px; border: 0; }
.pied { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 700; font-stretch: 80%; opacity: .75; letter-spacing: .01em; }
.trou { display: inline-block; width: 3.4em; border-bottom: .12em solid currentColor; transform: translateY(-.18em); }
.rep { background: var(--blanche); color: var(--blanche-ink); padding: 0 .18em; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.ligne-rep { display: block; margin-top: .45em; }

.penche-g { transform: rotate(-1.6deg); }
.penche-d { transform: rotate(1.2deg); }

/* Grille de la main */
.main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.main .carte { position: relative; border: 0; transition: transform .15s ease, box-shadow .15s ease; }
.main .carte[aria-pressed="true"] { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 0 0 3px var(--accent), 0 14px 28px var(--ombre); }
.rang {
  position: absolute; top: -9px; right: -7px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  font-size: 15px; font-weight: 800; font-stretch: 100%;
}

/* Panneaux et textes */
.panneau { background: var(--panel); border-radius: 16px; padding: 18px; box-shadow: 0 8px 24px var(--ombre); display: flex; flex-direction: column; gap: 14px; }
.panneau h2 { margin: 0; font-size: 17px; font-weight: 800; }
.titre-ligne { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.consigne { margin: 0; font-weight: 700; font-size: 17px; background: var(--panel); padding: 8px 14px; border-radius: 10px; align-self: flex-start; box-shadow: 0 3px 10px var(--ombre); }
.panneau .consigne, .feuille .consigne { background: transparent; padding: 0; box-shadow: none; }
.discret { color: var(--muted); font-size: 14px; margin: 0; }
.barre .discret { text-align: center; background: var(--nappe); border-radius: 8px; padding: 2px 8px; align-self: center; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 8px; }
.etiquette { background: var(--panel); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 700; box-shadow: 0 3px 10px var(--ombre); }
.etiquette.boss { background: var(--accent); color: var(--accent-ink); }

/* Saisie */
.formulaire { display: flex; flex-direction: column; gap: 8px; }
.formulaire label { font-weight: 800; font-size: 17px; }
.formulaire label + input { margin-bottom: 10px; }
.champ {
  width: 100%; box-sizing: border-box; min-width: 0; height: 52px; border-radius: 12px; border: 2px solid var(--muted);
  background: var(--nappe); padding: 0 14px; font-size: 17px; font-weight: 700;
}
.champ:focus { border-color: var(--accent); outline: none; }
.champ.code {
  height: 76px; font-size: 52px; font-weight: 900; font-stretch: 72%; letter-spacing: .14em; padding: 0 16px;
}
textarea.champ { height: auto; min-height: 132px; padding: 12px 14px; line-height: 1.35; resize: vertical; font-size: 16px; }
.champ::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }
.erreur { color: var(--accent); font-size: 15px; font-weight: 800; margin: 0; }
.barre .erreur { background: var(--panel); border-radius: 10px; padding: 8px 12px; box-shadow: 0 3px 10px var(--ombre); }

/* Joueurs : pastilles. Pleine = a joué, rouge = Boss, tirets = déconnecté. */
.joueurs { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.joueurs li {
  display: flex; align-items: center; gap: 6px; min-height: 40px; box-sizing: border-box;
  background: var(--nappe); border: 2px solid var(--line); border-radius: 999px; padding: 0 14px; font-weight: 700;
}
.joueurs li.avec-bouton { padding-right: 0; }
.joueurs .role { color: var(--muted); font-size: 13px; font-weight: 700; }
.joueurs button { border: 0; background: transparent; width: 44px; height: 44px; margin: -2px 0; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--muted); }
.joueurs button:hover { color: var(--accent); }
.joueurs li.joue { background: var(--fg); border-color: var(--fg); color: var(--panel); }
.joueurs li.joue .role { color: inherit; }
.joueurs li.boss { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.joueurs li.boss .role { color: inherit; }
.joueurs li.absent { color: var(--muted); border-style: dashed; border-color: var(--muted); background: var(--nappe); }
.joueurs li.joue.absent { background: var(--muted); color: var(--panel); border-style: solid; }
.joueurs li.boss.absent { background: var(--nappe); color: var(--accent); border-color: var(--accent); }
.joueurs li.hors-manche { color: var(--muted); }

.statut { display: flex; flex-direction: column; gap: 10px; }
.statut .phrase { margin: 0; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.segments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.segments button { height: 44px; border-radius: 10px; border: 2px solid var(--line); background: transparent; font-weight: 800; font-variant-numeric: tabular-nums; }
.segments button[aria-pressed="true"] { background: var(--fg); color: var(--panel); border-color: var(--fg); }

/* Boutons */
.btn { height: 54px; border-radius: 999px; border: 0; padding: 0 22px; font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.btn.plein { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px var(--ombre); }
.btn.plein:disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: default; }
.btn.calme { background: var(--panel); color: var(--fg); box-shadow: 0 3px 10px var(--ombre); }
.btn.petit { height: 44px; font-size: 15px; width: auto; padding: 0 16px; }
.btn.texte { background: transparent; height: auto; min-height: 44px; padding: 8px; width: auto; color: var(--muted); font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.barre .btn.texte { align-self: center; background: var(--nappe); border-radius: 10px; }
.rangee { display: flex; gap: 10px; }
.rangee > * { flex: 1; }
.rangee.gauche > * { flex: none; }

.barre {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 12px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(to top, var(--nappe) 60%, transparent);
}

/* Salon : le code posé sur la table comme une étiquette, le QR imprimé sur une carte blanche. */
.table-code { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 6px 2px 0; }
.etiquette-code {
  background: var(--panel); border-radius: 14px; padding: 12px 18px 12px;
  box-shadow: 0 8px 22px var(--ombre); transform: rotate(-2deg);
  display: flex; flex-direction: column; gap: 4px;
}
.etiquette-code .code {
  margin: 0; font-family: var(--f-carte); font-weight: 900; font-stretch: 70%;
  font-size: clamp(50px, 15vw, 88px); line-height: .92; letter-spacing: .04em;
}
.carte.qr { box-sizing: border-box; width: clamp(96px, 27vw, 140px); min-height: 0; padding: 8px 8px 7px; gap: 6px; flex: none; }
.lien-ligne { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.lien-ligne .lien { margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; background: var(--nappe); border-radius: 6px; padding: 0 4px; }
.carte.qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; border-radius: 4px; }

/* Bandeaux d'état */
.bandeau { margin: 0; font-weight: 800; font-size: 15px; padding: 10px 14px; border-radius: 10px; background: var(--fg); color: var(--panel); box-shadow: 0 3px 10px var(--ombre); }
.bandeau.alerte { background: var(--accent); color: var(--accent-ink); }

/* Jugement */
.choix { display: flex; flex-direction: column; gap: 14px; }
.choix button.carte { cursor: pointer; width: 100%; transition: transform .15s ease, box-shadow .15s ease; }
.choix .carte[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--accent), 0 14px 30px var(--ombre); transform: scale(1.01); }

/* Résultat */
.gagnant { font-family: var(--f-carte); font-weight: 900; font-stretch: 72%; font-size: clamp(38px, 11vw, 56px); line-height: 1; margin: 0; background: var(--panel); padding: 14px 18px 12px; border-radius: 14px; align-self: flex-start; transform: rotate(-2deg); box-shadow: 0 8px 22px var(--ombre); overflow-wrap: anywhere; }
.claque { animation: claque .45s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes claque { from { transform: scale(1.12) rotate(-5deg); } to { transform: scale(1) rotate(-1.4deg); } }
.scores { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.scores li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.scores li:last-child { border-bottom: 0; }
.scores .absent { color: var(--muted); }
.scores .droite { display: flex; align-items: center; }
.scores .pts { font-variant-numeric: tabular-nums; font-size: 18px; }
.scores button { border: 0; background: transparent; width: 44px; height: 44px; margin-left: 4px; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--muted); }
.scores button:hover { color: var(--accent); }
.barre-pts { display: flex; gap: 3px; margin-left: 10px; }
.barre-pts i { width: 8px; height: 14px; border-radius: 2px; background: var(--line); }
.barre-pts i.on { background: var(--accent); }
.autres { display: flex; flex-direction: column; gap: 10px; }
.autres .ligne { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; margin: 0; }
.autres .ligne span:first-child { font-weight: 700; flex: none; }
.autres .ligne span:last-child { text-align: right; }

/* Feuille des scores */
dialog.voile { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 540px; max-height: 92vh; background: transparent; color: inherit; overflow: visible; }
dialog.voile::backdrop { background: rgb(30 10 12 / .45); }
@media (prefers-color-scheme: dark) { dialog.voile::backdrop { background: rgb(0 0 0 / .6); } }
.feuille { background: var(--panel); border-radius: 20px 20px 0 0; padding: 20px max(18px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow-y: auto; box-sizing: border-box; }
.feuille h2 { margin: 0; font-size: 17px; font-weight: 800; }
.feuille .code-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feuille .code-ligne strong { font-weight: 900; font-stretch: 70%; font-size: 34px; line-height: 1; letter-spacing: .05em; }

.credit { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 0; }
.credit a { color: inherit; }
.credit-fond { background: var(--panel); border-radius: 10px; padding: 8px 12px; align-self: center; }
.avis { margin: 0; font-weight: 800; font-size: 16px; background: var(--panel); padding: 10px 14px; border-radius: 10px; box-shadow: 0 3px 10px var(--ombre); align-self: flex-start; }

/* Cartes maison, repliées tant qu'on n'en a pas besoin */
.maison summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  min-height: 44px; font-size: 17px; font-weight: 800; border-radius: 10px;
}
.maison summary::-webkit-details-marker { display: none; }
.maison summary::after { content: "+"; font-size: 24px; font-weight: 700; color: var(--muted); width: 44px; text-align: center; }
.maison[open] summary::after { content: "−"; }
.maison .formulaire { margin-top: 8px; }

.hors-ecran { position: fixed; top: -1000px; left: 0; opacity: 0; }

@media (min-width: 700px) {
  .app { max-width: 620px; }
  dialog.voile { max-width: 620px; }
  .main { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
