/* Jeu : capture le roi
   Mise en page : l'échiquier à gauche (avec le choix de l'équipe et le niveau au-dessus),
   la consigne et le compteur de coups à droite (l'un sous l'autre sur téléphone). */
.ecran-roi { max-width: 1040px; }

.jeu-roi {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: center;
  gap: 28px;
}
.plateau-roi {
  width: min(100%, 580px, calc(100vh - 270px));
  width: min(100%, 580px, calc(100dvh - 270px));
}
.choix-ligne button.avec-texte > svg { width: 32px; height: 32px; }
/* bouton « 2 joueurs » : la dame et le cavalier côte à côte */
.deux-pieces { display: inline-flex; flex: none; }
.deux-pieces svg { width: 24px; height: 32px; }
.deux-pieces svg + svg { margin-left: -6px; }
/* en mode 2 joueurs : pas de niveau, pas de défis */
body.deux-joueurs #reg-niveau, body.deux-joueurs #btn-defis { display: none; }

/* défis */
body[data-chrono="oui"] .seulement-sans-chrono,
body:not([data-chrono="oui"]) .seulement-chrono { display: none !important; }
.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; }
.etoiles-partie { margin: 0; font-weight: 600; line-height: 1.45; }
.etoiles-partie:empty { display: none; }
#btn-suivante svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#btn-suivante[hidden] { display: none; }
.res-liste .res-t { line-height: 1.3; text-align: center; }

/* les coups possibles */
.plateau-roi .case-e { cursor: default; }
.plateau-roi .case-e.possible, .plateau-roi .case-e.possible-prise { cursor: pointer; }
.case-e.possible::after { opacity: 1; background: radial-gradient(circle, rgba(24, 30, 40, .35) 0 15%, transparent 17%); }
.case-e.possible-prise::after { opacity: 1; background: radial-gradient(circle, transparent 0 60%, rgba(47, 163, 107, .85) 62% 76%, transparent 78%); }
.case-e.possible.dangereuse::after { background: radial-gradient(circle, rgba(200, 50, 60, .85) 0 17%, transparent 19%); }
.case-e.possible:hover::after { background: radial-gradient(circle, rgba(24, 30, 40, .5) 0 19%, transparent 21%), rgba(47, 163, 107, .18); }
.case-e.possible.dangereuse:hover::after { background: radial-gradient(circle, rgba(200, 50, 60, .95) 0 20%, transparent 22%), rgba(200, 50, 60, .15); }
.case-e.ma-piece::after { opacity: 1; box-shadow: inset 0 0 0 4px rgba(47, 163, 107, .9); }

/* panneau de droite */
.panneau-roi { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.question {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--ligne);
}
.piece-question { flex: none; width: 52px; height: 52px; padding: 5px; border-radius: 14px; background: var(--surface-2); }
.question-titre { margin: 0 0 4px; font-size: 21px; font-weight: 700; line-height: 1.2; }
.question-texte { margin: 0; color: var(--encre-douce); line-height: 1.45; }
.compteur { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; }
.compteur-nombre { margin: 0; font-size: 20px; font-weight: 600; color: var(--encre-douce); }
#coups { font-size: 44px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.etat { margin: 0; font-weight: 600; text-align: right; }
.bareme { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); color: var(--encre-douce); font-size: 14px; line-height: 1.45; }
.panneau-roi .bouton-secondaire svg, .res-actions svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 860px) {
  .jeu-roi { grid-template-columns: 1fr; gap: 14px; align-content: start; }
  .plateau-roi { width: min(100%, 520px, calc(100dvh - 380px)); min-width: min(100%, 280px); }
  .panneau-roi { gap: 10px; width: min(100%, 520px); justify-self: center; }
  .question { padding: 10px 12px; }
  .piece-question { width: 40px; height: 40px; }
  .question-titre { font-size: 18px; }
  .question-texte { font-size: 14px; }
  #coups { font-size: 34px; }
}
@media (max-width: 560px) {
  .choix-jeu { flex-wrap: nowrap; }
  .choix-jeu .texte-choix { display: none; }
  .choix-ligne button.avec-texte { width: 46px; padding: 5px; justify-content: center; }
  .choix-ligne button.avec-texte .deux-pieces svg { width: 20px; height: 28px; }
  .choix-ligne button.avec-texte > svg { width: 32px; height: 32px; }
}
/* petit téléphone : le titre passe sous les boutons pour ne pas être écrasé */
@media (max-width: 420px) {
  /* (le titre reste à côté des boutons : il n'y a plus de boutons de langue ni de thème) */
}

/* choix de l'équipe : les pièces côte à côte dans chaque bouton */
.choix-equipe { flex-wrap: wrap; justify-content: center; }
.choix-ligne.choix-equipe button { width: auto; min-width: 46px; padding: 4px 6px; }
.equipe-pieces { display: inline-flex; }
.equipe-pieces svg { width: 22px; height: 30px; }
.equipe-pieces svg + svg { margin-left: -7px; }
.choix-equipe svg.de { width: 26px; height: 26px; }
.equipe-question { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 52px; padding: 0 6px; box-sizing: border-box; border-radius: 14px; background: var(--surface-2); }
.equipe-question svg { width: 26px; height: 36px; }
.equipe-question svg + svg { margin-left: -8px; }
/* les pièces qu'on peut jouer */
.case-e.jouable { cursor: pointer; }
.case-e.jouable::after { opacity: 1; box-shadow: inset 0 0 0 3px rgba(47, 163, 107, .45); }
.plateau-roi .case-e.ma-piece { cursor: grab; }
.chargement .carte-choix { width: auto; text-align: center; }
.chargement .carte-choix-intro { margin: 0; font-weight: 600; }
@media (max-width: 560px) {
  .choix-jeu { flex-wrap: wrap; }
  .choix-ligne.choix-equipe button { min-width: 38px; width: auto; padding: 3px 4px; }
  .equipe-pieces svg { width: 17px; height: 25px; }
  .equipe-pieces svg + svg { margin-left: -6px; }
  .equipe-question { min-width: 40px; height: 40px; }
  .equipe-question svg { width: 20px; height: 28px; }
}

/* revoir les coups : sous l'échiquier */
.navigation-coups { display: flex; align-items: center; justify-content: center; gap: 6px; }
.navigation-coups .bouton-icone { width: 42px; height: 42px; }
.navigation-coups .bouton-icone:disabled { opacity: .35; cursor: default; }
.navigation-coups svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.navigation-coups [data-nav="debut"] svg path:last-child, .navigation-coups [data-nav="fin"] svg path:last-child { fill: currentColor; }
.nav-numero { min-width: 76px; text-align: center; font-weight: 600; color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.navigation-coups.en-arriere .nav-numero { color: var(--accent); }
.navigation-coups.en-arriere::after { content: ""; }
/* boutons de la partie */
.actions-partie { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-partie button { flex: 1 1 140px; }
.actions-partie button[hidden] { display: none; }
.actions-partie svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* fin de partie : « Nouvelle partie » (en vert) tient sur une ligne */
.res-actions > button { white-space: nowrap; }

/* téléphone : le compteur, le barème et les boutons se font petits, pour laisser toute la largeur à l'échiquier */
@media (max-width: 560px) {
  .panneau-roi { gap: 6px; }
  .compteur { align-items: center; padding: 0 2px; }
  .compteur-nombre { font-size: 15px; }
  #coups { font-size: 26px; }
  .etat { font-size: 15px; }
  .bareme { padding: 5px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.35; }
  .actions-partie { flex-wrap: nowrap; gap: 6px; }
  .actions-partie button { flex: 1 1 0; min-width: 0; padding: 0 8px; font-size: 15px; white-space: nowrap; }
}
