/* Mini-jeux : styles du module (les couleurs viennent du thème du site) */
.mj-jeux { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.mj-carte { display: flex; gap: 1rem; padding: 1.1rem 1.2rem; border-radius: 14px; border: 1px solid var(--border-soft); background: var(--bg-2); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.mj-carte:hover, .mj-carte:focus-visible { border-color: var(--primary); transform: translateY(-2px); }
.mj-emoji { flex: none; width: 3.2rem; height: 3.2rem; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--primary) 16%, transparent); font-size: 1.7rem; }
.mj-carte-texte { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.mj-carte-texte strong { font: 800 1.12rem var(--font-title); letter-spacing: .03em; }
.mj-carte-texte .muted { font-size: .95rem; line-height: 1.35; }
.mj-carte-pied { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.mj-points { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: .8rem; }
.mj-points div { display: flex; flex-direction: column; padding: .7rem .8rem; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border-soft); }
.mj-points strong { font: 800 1.6rem var(--font-title); }
.mj-stats { width: 100%; border-collapse: collapse; }
.mj-stats th, .mj-stats td { padding: .3rem .4rem; text-align: right; border-bottom: 1px solid var(--border-soft); }
.mj-stats th:first-child, .mj-stats td:first-child { text-align: left; }
.mj-stats th { color: var(--muted); font-weight: 600; }
.mj-top { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.mj-top li { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: 8px; }
.mj-top li.mj-moi { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.mj-top img { border-radius: 50%; flex: none; }
.mj-rang { flex: none; width: 1.4rem; text-align: center; color: var(--muted); font-weight: 700; }
.mj-top li:nth-child(1) .mj-rang { color: #ffd166; } .mj-top li:nth-child(2) .mj-rang { color: #cfd6e4; } .mj-top li:nth-child(3) .mj-rang { color: #e0a070; }
.mj-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mj-page { max-width: 640px; }
.mj-regles { margin-bottom: 1rem; padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-2); }
.mj-regles summary { cursor: pointer; font-weight: 700; }
.mj-regles p { margin: .5rem 0 .2rem; color: var(--muted); }
.mj-centre { text-align: center; }
.mj-centre .btn { margin-bottom: .5rem; }
.mj-plateau { margin-bottom: 1rem; }
.mj-bilan { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--border); }
.mj-bilan strong { font: 800 1.25rem var(--font-title); }
.mj-bilan.mj-gagne { border-color: rgba(61,220,151,.5); background: rgba(61,220,151,.1); }
.mj-bilan.mj-perdu { border-color: rgba(255,92,122,.45); background: rgba(255,92,122,.08); }
.mj-bilan.mj-egal { border-color: rgba(255,181,71,.45); background: rgba(255,181,71,.08); }
.mj-gain { margin-left: auto; font-weight: 700; }
.mj-saisie { display: flex; gap: .6rem; justify-content: center; margin: 0 auto .6rem; max-width: 380px; }
.mj-saisie input { flex: 1; min-width: 0; text-align: center; font: 700 1.15rem var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.mj-saisie input::placeholder { letter-spacing: normal; text-transform: none; font-weight: 500; font-size: .95rem; }

/* mot mystère */
.mj-grille-mot { display: grid; gap: .35rem; justify-content: center; margin-bottom: 1rem; }
.mj-ligne-mot { display: grid; grid-template-columns: repeat(5, 3rem); gap: .35rem; }
.mj-lettre { display: grid; place-items: center; height: 3rem; border-radius: 8px; border: 2px solid var(--border-soft); font: 800 1.4rem var(--font-title); text-transform: uppercase; }
.mj-lettre.mj-ok, .mj-pastille.mj-ok, .mj-clavier .mj-ok { background: #2f9e6c; border-color: #2f9e6c; color: #fff; }
.mj-lettre.mj-mal, .mj-pastille.mj-mal { background: #c98a1b; border-color: #c98a1b; color: #fff; }
.mj-lettre.mj-non { background: var(--border-soft); border-color: transparent; color: var(--muted); }
.mj-connues { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center; margin: .8rem 0 0; }
.mj-lettre.mj-petite { width: 1.9rem; height: 1.9rem; border-width: 1px; border-radius: 6px; font-size: .95rem; }

/* pendu */
.mj-pendu { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1rem; }
.mj-pendu svg { flex: none; fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.mj-potence { stroke: var(--muted); }
.mj-corps { stroke: var(--accent); }
.mj-pendu > div { min-width: 0; flex: 1; }
.mj-mot { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .5rem; }
.mj-mot span { display: grid; place-items: center; width: 1.7rem; height: 2.3rem; border-bottom: 3px solid var(--border); font: 800 1.35rem var(--font-title); }
.mj-clavier { display: grid; grid-template-columns: repeat(auto-fit, minmax(2.6rem, 1fr)); gap: .35rem; }
.mj-clavier button { height: 2.7rem; border-radius: 8px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--text); font: 700 1.05rem var(--font); cursor: pointer; touch-action: manipulation; }
.mj-clavier button:hover:not(:disabled) { border-color: var(--primary); }
.mj-clavier button:disabled { cursor: default; opacity: .9; }
.mj-clavier .mj-non { background: transparent; color: var(--muted); opacity: .45; }

/* juste prix */
.mj-essais { list-style: none; margin: .8rem auto 0; padding: 0; max-width: 380px; display: flex; flex-direction: column; gap: .3rem; }
.mj-essais li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .8rem; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border-soft); }
.mj-essais .mj-plus span { color: var(--info, #6cb8ff); } .mj-essais .mj-moins span { color: var(--warn); }
.mj-essais .mj-ok { border-color: rgba(61,220,151,.5); } .mj-essais .mj-ok span { color: var(--ok); font-weight: 700; }

/* coffre-fort */
.mj-codes { width: 100%; max-width: 380px; margin: .8rem auto 0; border-collapse: collapse; text-align: center; }
.mj-codes th { padding: .3rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.mj-codes td { padding: .35rem; border-top: 1px solid var(--border-soft); }
.mj-codes td.mono { font-size: 1.25rem; font-weight: 700; letter-spacing: .3em; }
.mj-pastille { display: inline-grid; place-items: center; min-width: 1.9rem; height: 1.9rem; border-radius: 50%; font-weight: 800; }

/* blackjack */
.mj-table { display: grid; gap: 1rem; margin-bottom: 1rem; }
.mj-table h2 { margin: 0 0 .4rem; }
.mj-main { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.mj-carte-jeu { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 3.1rem; height: 4.3rem; border-radius: 8px; background: #f4f8fa; color: #12191f; font: 800 1.25rem var(--font); line-height: 1; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.mj-carte-jeu i { font-style: normal; font-size: 1.25rem; margin-top: .15rem; }
.mj-carte-jeu.mj-rouge { color: #c8203f; }
.mj-carte-jeu.mj-dos { background: repeating-linear-gradient(45deg, var(--primary) 0 6px, color-mix(in srgb, var(--primary) 60%, #000) 6px 12px); }
.mj-coups { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.mj-coups .btn { flex: 1; min-width: 130px; }

/* démineur */
.mj-terrain { display: grid; grid-template-columns: repeat(8, minmax(0, 2.9rem)); gap: 3px; justify-content: center; margin-bottom: .6rem; }
.mj-case { aspect-ratio: 1; display: grid; place-items: center; padding: 0; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 800 1.05rem var(--font-title); }
button.mj-case { cursor: pointer; touch-action: manipulation; background: color-mix(in srgb, var(--primary) 22%, var(--surface)); }
button.mj-case:hover, button.mj-case:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--primary) 36%, var(--surface)); }
.mj-case.mj-vue { background: var(--bg-2); border-color: var(--border-soft); }
.mj-n1 { color: #6cb8ff; } .mj-n2 { color: #3ddc97; } .mj-n3 { color: #ff7a8f; } .mj-n4 { color: #9bcdff; } .mj-n5 { color: #ffb547; } .mj-n6 { color: #5fe0e0; } .mj-n7 { color: #f4f4f7; } .mj-n8 { color: #9aa0b4; }
.mj-case.mj-mine { background: rgba(255,92,122,.12); border-color: rgba(255,92,122,.4); font-size: .95rem; }
.mj-case.mj-boum { background: rgba(255,92,122,.5); }

@media (max-width: 560px) {
    .mj-ligne-mot { grid-template-columns: repeat(5, 2.75rem); }
    .mj-lettre { height: 2.75rem; }
    .mj-pendu { flex-direction: column; align-items: flex-start; gap: .6rem; }
    .mj-pendu svg { width: 90px; height: 105px; }
    .mj-mot span { width: 1.45rem; height: 2.1rem; font-size: 1.15rem; }
    .mj-gain { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .mj-carte { transition: none; } .mj-carte:hover { transform: none; } }

/* ------------------------------------------------------------------ échiquier et damier */
.mj-plateau.mj-large { padding: 1rem; }
.mj-damier { --clair: #ecdcbf; --fonce: #a8734c; --cadre: #4a2f1f; margin: 0; scroll-margin-top: 76px; }
.mj-cases { display: grid; width: min(100%, 560px); margin: 0 auto; aspect-ratio: 1; border: 10px solid var(--cadre); border-radius: 10px; background: var(--cadre);
    box-shadow: 0 0 0 1px #2a1a10, 0 14px 34px rgba(0,0,0,.5), inset 0 0 0 2px #7a5235; overflow: hidden; }
.mj-echiquier .mj-cases { grid-template-columns: repeat(8, 1fr); }
.mj-dames .mj-cases { grid-template-columns: repeat(10, 1fr); }
.mj-c { position: relative; display: grid; place-items: center; min-width: 0; padding: 0; margin: 0; border: 0; border-radius: 0; font: inherit; color: inherit; text-decoration: none; aspect-ratio: 1;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.mj-cl { background: var(--clair); }
.mj-cf { background: var(--fonce); background-image: linear-gradient(135deg, rgba(255,255,255,.06), rgba(0,0,0,.08)); }
a.mj-c, button.mj-c, .mj-c.mj-cible { cursor: pointer; }
.mj-c:focus-visible { outline: 3px solid #fff; outline-offset: -3px; z-index: 1; }
.mj-dernier { box-shadow: inset 0 0 0 100px rgba(255, 214, 64, .38); }
.mj-sel, .mj-sel.mj-dernier { box-shadow: inset 0 0 0 100px rgba(80, 200, 120, .55); }
.mj-echec { box-shadow: inset 0 0 0 100px rgba(235, 60, 70, .6); }
.mj-cible::after { content: ""; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(20, 90, 50, .55); pointer-events: none; }
.mj-cible:has(.mj-piece)::after, .mj-cible:has(.mj-pion)::after { width: 86%; height: 86%; background: none; border: 4px solid rgba(20, 110, 60, .8); box-sizing: border-box; }
.mj-rang, .mj-col, .mj-num { position: absolute; font: 700 .62rem var(--font); font-style: normal; line-height: 1; pointer-events: none; }
.mj-rang { top: 2px; left: 3px; } .mj-col { bottom: 2px; right: 3px; }
.mj-cl .mj-rang, .mj-cl .mj-col { color: var(--fonce); } .mj-cf .mj-rang, .mj-cf .mj-col { color: var(--clair); }
.mj-num { top: 2px; left: 3px; color: rgba(255, 240, 215, .6); font-size: .55rem; }
.mj-inerte .mj-cases { filter: saturate(.85); }
.mj-attente .mj-cases { opacity: .75; cursor: progress; }
.mj-attente .mj-etat p:first-child strong { visibility: hidden; position: relative; }
.mj-attente .mj-etat p:first-child strong::before { content: "L'ordinateur réfléchit…"; visibility: visible; position: absolute; white-space: nowrap; left: 0; }

/* pièces d'échecs */
.mj-piece { width: 88%; height: 88%; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); pointer-events: none; }
.mj-piece.mj-blanc { fill: #fdf9f0; stroke: #202430; } .mj-piece.mj-noir { fill: #202430; stroke: #efe4cf; stroke-width: 1.1; }
.mj-piece .mj-t { fill: none; } .mj-piece.mj-blanc .mj-t { stroke: #202430; } .mj-piece.mj-noir .mj-t { stroke: #efe4cf; }
.mj-piece.mj-blanc .mj-o { fill: #202430; stroke: none; } .mj-piece.mj-noir .mj-o { fill: #efe4cf; stroke: none; }

/* pions et dames */
.mj-pion { position: relative; width: 78%; height: 78%; border-radius: 50%; pointer-events: none; }
.mj-pion.mj-blanc { background: radial-gradient(circle at 50% 42%, #fffdf7 0 38%, #e9dcc2 39% 52%, #fbf4e4 53% 66%, #d9c8a8 67%); box-shadow: 0 3px 0 #b7a482, 0 5px 6px rgba(0,0,0,.45); }
.mj-pion.mj-noir { background: radial-gradient(circle at 50% 42%, #3f4755 0 38%, #222831 39% 52%, #343b47 53% 66%, #14181f 67%); box-shadow: 0 3px 0 #0a0c10, 0 5px 6px rgba(0,0,0,.5); }
.mj-pion.mj-dame { transform: translateY(-6%); }
.mj-pion.mj-dame.mj-blanc { box-shadow: 0 3px 0 #b7a482, 0 6px 0 #efe3ca, 0 9px 0 #b7a482, 0 11px 7px rgba(0,0,0,.45); }
.mj-pion.mj-dame.mj-noir { box-shadow: 0 3px 0 #0a0c10, 0 6px 0 #303743, 0 9px 0 #0a0c10, 0 11px 7px rgba(0,0,0,.5); }
.mj-pion.mj-dame::after { content: ""; position: absolute; inset: 22%; background: #c8962b; clip-path: polygon(0 100%, 0 28%, 25% 62%, 50% 12%, 75% 62%, 100% 28%, 100% 100%); }
.mj-jouable .mj-pion { outline: 2px solid rgba(120, 230, 150, .0); }
.mj-dames:has(.mj-oblige) .mj-jouable .mj-pion { outline: 3px solid #5fe08a; outline-offset: 1px; }
.mj-pris::before { content: ""; position: absolute; width: 62%; height: 62%; border-radius: 50%; border: 2px dashed rgba(255, 240, 215, .55); pointer-events: none; }

.mj-etat { width: min(100%, 560px); margin: .8rem auto 0; }
.mj-etat p { margin: 0 0 .4rem; }
.mj-oblige { color: var(--warn); font-weight: 600; font-size: .95rem; }
.mj-promo { display: flex; align-items: center; gap: .6rem; margin: 0 0 .5rem; font-weight: 500; color: var(--text); }
.mj-promo select { width: auto; }
.mj-variantes { display: flex; flex-wrap: wrap; gap: .4rem; }
.mj-historique { width: min(100%, 560px); margin: .6rem auto 0; color: var(--muted); }
.mj-historique summary { cursor: pointer; font-weight: 600; }
.mj-historique ol { margin: .5rem 0 0; padding-left: 2.2rem; max-height: 11rem; overflow-y: auto; columns: 2; column-gap: 1.5rem; font: 500 .92rem var(--mono); color: var(--text); }
.mj-historique li { break-inside: avoid; } .mj-historique li span { display: inline-block; min-width: 4.2rem; }

/* choix du niveau et du camp */
.mj-depart { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.mj-depart h2 { margin: 0; }
.mj-depart fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.mj-depart legend { padding: 0; margin-bottom: .4rem; color: var(--muted); font-weight: 600; font-size: .92rem; }
.mj-choix { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.mj-choix label { margin: 0; cursor: pointer; }
.mj-choix input { position: absolute; opacity: 0; pointer-events: none; }
.mj-choix span { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .6rem .3rem; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-2); text-align: center; color: var(--text); }
.mj-choix small { color: var(--muted); font-weight: 500; font-size: .78rem; }
.mj-choix input:checked + span { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 20%, var(--bg-2)); }
.mj-choix input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 560px) {
    .mj-plateau.mj-large { padding: .45rem; }
    .mj-cases { border-width: 6px; border-radius: 8px; }
    .mj-etat, .mj-historique { padding: 0 .4rem; }
    .mj-num { font-size: .46rem; top: 1px; left: 2px; } .mj-rang, .mj-col { font-size: .52rem; }
    .mj-pion.mj-blanc, .mj-pion.mj-noir { box-shadow: 0 2px 0 rgba(0,0,0,.45), 0 3px 4px rgba(0,0,0,.4); }
    .mj-pion.mj-dame.mj-blanc { box-shadow: 0 2px 0 #b7a482, 0 4px 0 #efe3ca, 0 6px 0 #b7a482, 0 7px 5px rgba(0,0,0,.45); }
    .mj-pion.mj-dame.mj-noir { box-shadow: 0 2px 0 #0a0c10, 0 4px 0 #303743, 0 6px 0 #0a0c10, 0 7px 5px rgba(0,0,0,.5); }
}

/* ------------------------------------------------------------------ mode en ligne */
.mj-onglets { display: flex; gap: .4rem; margin-bottom: 1rem; padding: .3rem; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--bg-2); }
.mj-onglets a { flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem .6rem; border-radius: 9px; color: var(--muted); font-weight: 700; text-align: center; text-decoration: none; }
.mj-onglets a:hover { color: var(--text); }
.mj-onglets a[aria-current="page"] { background: color-mix(in srgb, var(--primary) 26%, transparent); color: var(--text); }
.mj-page > .card { margin-bottom: 1rem; }
.mj-tables { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.mj-tables li { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-2); }
.mj-tables img, .mj-joueur img { border-radius: 50%; flex: none; }
.mj-table-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mj-table-texte strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mj-tables form { margin: 0; }
.mj-invitation { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; }
.mj-invitation code { padding: .45rem .7rem; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border-soft); font-size: .88rem; overflow-wrap: anywhere; user-select: all; }
.mj-tour { margin: 0 0 .8rem; padding: .6rem .9rem; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-2); }
.mj-tour.mj-a-moi { border-color: rgba(61,220,151,.55); background: rgba(61,220,151,.1); }
.mj-tour b { font-family: var(--mono); }
.mj-presse { color: var(--bad, #ff5c7a); }
.mj-nulle { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .8rem; padding: .6rem .9rem; border-radius: 10px; border: 1px solid rgba(255,181,71,.5); background: rgba(255,181,71,.1); }
.mj-nulle span { flex: 1; min-width: 12rem; }
.mj-joueur { display: flex; align-items: center; gap: .6rem; width: min(100%, 560px); margin: 0 auto; padding: .45rem .3rem; }
.mj-joueur > span:not(.mj-trait-pastille) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5rem; flex: 1; min-width: 0; }
.mj-joueur small { width: 100%; font-size: .8rem; }
.mj-trait-pastille { padding: .15rem .6rem; border-radius: 99px; background: rgba(61,220,151,.16); border: 1px solid rgba(61,220,151,.5); color: var(--ok); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.mj-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1rem; }
.mj-actions form { margin: 0; }
