/* Plateau de démonstration (accueil public, portail, leçon du jour) : cases, pièces qui glissent, commentaires, pastilles de leçons.
 * Les valeurs par défaut des couleurs sont définies ici pour que le plateau s'affiche aussi dans l'espace élève. */
:root { --sq-l: #d9d4ec; --sq-d: #7d6cb4; --ok: #5fcf9b; --dim: #6c6a7c; --acc-2: #a995ff; --line-2: #33333f; --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace; --f-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif; --ease: cubic-bezier(.2, .7, .2, 1); }
.board-card { background: linear-gradient(180deg, #14141c, #0d0d13); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: 0 50px 100px -40px #000, 0 0 0 1px #ffffff05 inset; }
.board-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 32px; margin-bottom: 12px; font: 500 12px/1 var(--f-mono); color: var(--mut); letter-spacing: .06em; }
.board-top > span:first-child { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.25; color: var(--txt); }   /* deux lignes pour les titres longs, hauteur fixe : « Partie espagnole, va… » n'est plus coupé */
.board-top .meta { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.board-top .kind { padding: 5px 9px; border-radius: 6px; border: 1px solid var(--line-2); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--mut); }
.board-top .kind[data-kind="Mat"] { color: #ff9b9b; border-color: #ff6b6b44; }
.board-top .kind[data-kind="Ouverture"] { color: var(--acc-2); border-color: #7c5cf066; }
.board-top .live { display: inline-flex; align-items: center; gap: 8px; }
.board-top .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
/* Téléphone : le badge et le compteur prennent leur propre ligne, le titre dessous a toute la largeur. À 375 px le badge « Ouverture » ne laissait que 116 px au titre : quatre titres sur dix étaient coupés. */
@media (max-width: 440px) {
  .board-top { flex-wrap: wrap; align-content: space-between; gap: 8px 12px; height: 62px; }
  .board-top .meta { order: -1; flex: 1 1 100%; justify-content: space-between; }
  .board-top > span:first-child { flex: 1 1 100%; }
}
.gboard { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); background: var(--sq-d); user-select: none; isolation: isolate; }      /* huit rangées égales, jamais plus grandes que leur part : une case en échec ne doit pas déformer le plateau ; « isolate » : les z-index des pièces et de la pastille restent dans le plateau */
.gboard .sq { position: relative; min-width: 0; min-height: 0; overflow: hidden; transition: background .5s; }
.gboard .sq.l { background: var(--sq-l); }
.gboard .sq.d { background: var(--sq-d); }
.gboard .sq.sq-last::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px #f5d76ab8; }
.gboard .sq.sq-check::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, #ff4d4dcc 0, #ff4d4d00 72%); }
.gboard .co { position: absolute; font: 500 9px/1 var(--f-mono); opacity: .7; pointer-events: none; }
.gboard .sq.l .co { color: var(--sq-d); }
.gboard .sq.d .co { color: var(--sq-l); }
.gboard .co.r { top: 4px; left: 4px; }
.gboard .co.f { bottom: 4px; right: 4px; }
.gboard .layer { position: absolute; inset: 0; pointer-events: none; }
.gboard .pc { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; background-size: 90%; background-position: center; background-repeat: no-repeat; transition: transform .45s var(--ease); will-change: transform; pointer-events: none; z-index: 1; }
.gboard .pc.moving { z-index: 3; }
.gboard .pc.moving.second { z-index: 2; }
.gboard .pc.land { animation: land .32s var(--ease); }
@keyframes land { 0% { background-size: 90%; } 40% { background-size: 101%; } 100% { background-size: 90%; } }   /* pas de « scale » : la position est dans transform, et scale s'y applique par-dessus, ce qui écartait la pièce de sa case pendant le rebond */
.gboard .pc.in { animation: drop .6s var(--ease) both; }
@keyframes drop { from { opacity: 0; translate: 0 -14%; } to { opacity: 1; translate: 0 0; } }
/* Traînée : géométrie (départ, longueur, angle) posée par le script ; elle grandit comme la pièce (même durée, même courbe) puis s'efface. Rien que transform et opacity. */
.gboard .gb-trail { position: absolute; z-index: 0; transform-origin: 0 50%; pointer-events: none; }
.gboard .gb-trail i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #f5d76a00, #f5d76ad9); clip-path: polygon(0 50%, 100% 0, 100% 100%); transform: scaleX(0); transform-origin: 0 50%; transition: transform .45s var(--ease), opacity .52s ease-out; }
.gboard .gb-trail.go i { transform: scaleX(1); }
.gboard .gb-trail.fade i { opacity: 0; }
/* Pastille de mat : dans le coin haut droit de la case du roi maté (position en % posée par le script, taille ici, en % du plateau donc la même à toutes les largeurs). */
.gboard .gb-mate { position: absolute; z-index: 4; width: 5.6%; height: 5.6%; margin: .4% 0 0 -6%; pointer-events: none; filter: drop-shadow(0 1px 1.5px #00000066); }
.gboard .gb-mate svg { display: block; width: 100%; height: 100%; }
.gboard .gb-mate circle { fill: #c8372f; stroke: #fff; stroke-width: 1.5; }
.gboard .gb-mate path { fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; }
.gboard .gb-mate.pop { animation: gb-mate-pop .42s .14s var(--ease) both; }
@keyframes gb-mate-pop { 0% { transform: scale(.3); opacity: 0; } 55% { transform: scale(1.16); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.gboard .arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.board-moves { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0 10px; margin-top: 16px; font: 500 13px/22px var(--f-mono); color: var(--dim); height: 66px; overflow: hidden; }
.board-moves .mv { transition: color .3s; }
.board-moves .mv.now { color: var(--txt); }
.board-moves .mv.done { color: var(--mut); }
.board-moves .n { color: #8a889f; }
.board-cap { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); height: 78px; overflow: hidden; }
.board-cap b { flex: 1 1 50%; min-width: 0; font: 700 16px/1.25 var(--f-display); letter-spacing: -.01em; }
.board-cap span { flex: 1 1 50%; min-width: 0; font-size: 13px; line-height: 1.45; color: var(--mut); text-align: right; }
.lesson-dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.lesson-dots .dot { position: relative; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: #34343f; cursor: pointer; transition: width .45s var(--ease), background .3s; }
.lesson-dots .dot::after { content: ''; position: absolute; inset: -9px -4px; }
.lesson-dots .dot:hover { background: #55556a; }
.lesson-dots .dot.on { width: 26px; background: var(--acc); }
/* ── Leçon du jour (accueil élève) ─────────────────────────────────── */
.lesson-card .ls-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.lesson-card .ls-kicker { font: 500 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--acc-2); }
.lesson-card h3 { margin: 10px 0 4px; font: 800 22px/1.15 var(--f-display); letter-spacing: -.025em; }
.lesson-card .ls-head p { margin: 0; font-size: 14px; }
.lesson-card .kind { flex: none; padding: 5px 9px; border-radius: 6px; border: 1px solid var(--line-2); font: 500 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mut, #9d9bab); }
.lesson-card .kind[data-kind="Mat"] { color: #ff9b9b; border-color: #ff6b6b44; }
.lesson-card .kind[data-kind="Ouverture"] { color: var(--acc-2); border-color: #7c5cf066; }
.lesson-card .ls-body { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
.lesson-card .ls-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lesson-card .board-moves { margin-top: 0; height: 88px; }
.lesson-card .board-moves button.mv { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.lesson-card .board-moves button.mv:hover { color: var(--txt, #f3f1ec); }
.lesson-card .ls-note { height: 44px; overflow: hidden; font-size: 14.5px; line-height: 1.5; color: var(--txt, #f3f1ec); }
.lesson-card .ls-bar { height: 3px; border-radius: 3px; background: #24242b; overflow: hidden; }
.lesson-card .ls-bar i { display: block; height: 100%; width: 0; background: var(--acc, #7c5cf0); transition: width .5s var(--ease); }
.lesson-card .ls-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.lesson-card .ls-controls .btn[disabled] { opacity: .4; cursor: default; }
@media (max-width: 760px) { .lesson-card .ls-body { grid-template-columns: minmax(0, 1fr); } .lesson-card .board-moves { height: 66px; } }
/* ── Point de rupture (accueil élève) : la même carte que la leçon du jour, avec les chiffres réels du Ghost à la place des coups ── */
.rupture-card[hidden], .rupture-card .kind[hidden], .rupture-card .btn[hidden] { display: none; }
.rupture-card .hr-evidence { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 14.5px; line-height: 1.5; color: var(--mut, #9d9bab); }
.rupture-card .hr-evidence li:first-child { color: var(--txt, #f3f1ec); font-weight: 600; }
.rupture-card .ls-body[data-empty] { grid-template-columns: minmax(0, 1fr); }
.rupture-card .ls-body[data-empty] .gboard { display: none; }
.rupture-card .ls-controls a.btn { text-decoration: none; }
.rupture-card .kind[data-kind="Position"] { color: var(--gold, #e3b75a); border-color: #e3b75a55; }
.rupture-card .kind[data-kind="Zone"] { color: var(--acc-2); border-color: #7c5cf066; }
@media (prefers-reduced-motion: reduce) { .lesson-card .ls-bar i { transition: none; } }

@media (prefers-reduced-motion: reduce) {
  .gboard .pc { transition: none; }
  .gboard .pc.land, .gboard .pc.in { animation: none; }
  .gboard .gb-trail { display: none; }
  .gboard .gb-mate.pop { animation: none; }
  .lesson-dots .dot { transition: none; }
}
