/* Jeu : mat ou pas mat ?
   Mise en page : l'échiquier à gauche, la question et les réponses à droite
   (l'un sous l'autre sur téléphone). */
.ecran-mat { max-width: 1040px; }

body[data-chrono="oui"] .seulement-sans-chrono,
body:not([data-chrono="oui"]) .seulement-chrono { display: none !important; }

.jeu-mat {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: center;
  gap: 28px;
}
.plateau-mat {
  width: min(100%, 580px, calc(100vh - 210px));
  width: min(100%, 580px, calc(100dvh - 210px));
}
/* le bouton « pat » au-dessus de l'échiquier (mode libre) */
.pat-icone { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--or) 22%, transparent); }
.pat-icone svg { width: 26px; height: 26px; }
.pat-icone b { position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--or); color: #2A2E38; font-size: 14px; line-height: 1; box-shadow: 0 0 0 2px var(--surface); }
.panneau-mat { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.question {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--ligne);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}
.question.nouvelle { animation: nouvelle .4s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes nouvelle { from { transform: scale(.94); opacity: .3; } }
.roi-question {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}

.reponses { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* avec le bouton « pat » : mat, pat, puis ni l'un ni l'autre */
body.avec-pat .reponses { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reponse.pat { order: 1; }
.reponse.pas-mat { order: 2; }
body:not(.avec-pat) .avec-pat { display: none; }
.reponse {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 2px solid var(--ligne);
  border-radius: 18px;
  background: var(--surface);
  color: var(--encre);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
}
.reponse:hover { border-color: var(--accent); }
.reponse:active { transform: scale(.97); }
.reponse-icone { position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; }
.reponse-icone .roi-icone { width: 50px; height: 50px; }
.reponse.mat .reponse-icone { background: color-mix(in srgb, var(--alerte) 16%, transparent); }
.reponse.pas-mat .reponse-icone { background: var(--accent-doux); }
.reponse.pat .reponse-icone { background: color-mix(in srgb, var(--or) 22%, transparent); }
.badge-diese {
  position: absolute;
  right: -7px;
  bottom: -7px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  color: #FFFFFF;
  box-shadow: 0 0 0 3px var(--surface);
}
.reponse.mat .badge-diese { background: var(--alerte); }
.reponse.pas-mat .badge-diese { background: var(--accent); color: var(--sur-accent); }
.reponse.pat .badge-diese { background: var(--or); color: #2A2E38; font-size: 19px; }
.badge-diese.barre::after { content: ""; position: absolute; width: 18px; height: 2.5px; border-radius: 2px; background: currentColor; transform: rotate(-45deg); }

.retour {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 2px solid var(--ligne);
  animation: nouvelle .35s cubic-bezier(.2, 1.3, .4, 1);
}
.retour.juste { border-color: var(--accent); }
.retour.faux { border-color: var(--alerte); }
.verdict { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; font-weight: 700; }
.verdict svg { flex: none; width: 30px; height: 30px; padding: 5px; border-radius: 50%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; box-sizing: border-box; }
.retour.juste .verdict { color: var(--accent); }
.retour.juste .verdict svg { background: var(--accent-doux); }
.retour.faux .verdict { color: var(--alerte); }
.retour.faux .verdict svg { background: color-mix(in srgb, var(--alerte) 16%, transparent); }
.motif {
  align-self: flex-start;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--encre-douce);
}
.explication { margin: 0 0 4px; line-height: 1.5; }
.lien-partie { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: -2px 0 4px; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
.lien-partie:hover { text-decoration: underline; }
.lien-partie svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#btn-suivant svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.score-libre { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--accent); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.score-libre svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.astuce { margin: 0; font-size: 13px; color: var(--encre-douce); }
.astuce kbd { padding: 1px 6px; border: 1px solid var(--ligne); border-radius: 6px; background: var(--surface); font: inherit; font-weight: 600; }
@media (hover: none) { .astuce { display: none; } }

/* minuteur (défi chrono) */
.minuteur { flex: 1; height: 14px; border: 1px solid var(--ligne); border-radius: 7px; background: var(--surface-2); overflow: hidden; }
#minuteur-barre { height: 100%; border-radius: 7px; background: var(--accent); transform-origin: left center; transition: background .3s; }
body.presse #minuteur-barre { background: var(--alerte); }
.bandeau-defi .points { flex: none; }

/* résultats */
.res-liste .res-t { font-weight: 600; }

@media (max-width: 860px) {
  .jeu-mat { grid-template-columns: 1fr; gap: 14px; align-content: start; }
  .plateau-mat { width: min(100%, 520px, calc(100dvh - 440px)); min-width: min(100%, 280px); }
  .panneau-mat { gap: 12px; width: min(100%, 520px); justify-self: center; }
  .question { font-size: 18px; padding: 10px 12px; }
  .roi-question { width: 36px; height: 36px; }
  .reponse { flex-direction: row; justify-content: center; padding: 10px; font-size: 16px; }
  .reponse-icone { width: 46px; height: 46px; border-radius: 12px; }
  .reponse-icone .roi-icone { width: 36px; height: 36px; }
  .badge-diese { width: 22px; height: 22px; font-size: 14px; right: -6px; bottom: -6px; }
  .badge-diese.barre::after { width: 15px; }
  body.avec-pat .reponse { flex-direction: column; gap: 6px; padding: 10px 6px; font-size: 15px; text-align: center; }
}

/* pas de consigne sous l'échiquier : elle est dans l'aide « ? » (js/aide.js) */
#question { display: none !important; }

/* très petit téléphone : les deux réponses tiennent côte à côte */
@media (max-width: 360px) {
  .reponses { gap: 6px; }
  .reponse { min-width: 0; gap: 6px; padding: 8px 6px; font-size: 14.5px; }
  .reponse-icone { flex: none; width: 40px; height: 40px; }
  .reponse-icone .roi-icone { width: 32px; height: 32px; }
}
