/* ══════════════════════════════════════════════════════════════════════════
   « Faites vos jeux ! » — feuille de style partagée par les trois pages
   (la catégorie, l'outil de création, le lecteur).

   Charte du site : fond bleu clair de l'accueil (--paper #f2f5fa), Cormorant
   Garamond pour les titres, Montserrat pour le texte.
   ⚠️ CONTRASTE : l'or #b89a5a ne donne que 2,5:1 sur fond clair — il sert aux
   filets et aux aplats, jamais au texte, pour lequel on utilise --gold-txt.
   De même --muted #7a7060 tombe à 4,45:1 sur #f2f5fa (seuil AA 4,5), d'où
   #6e6659.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  --ink: #1a1814;
  --paper: #f2f5fa;
  --paper-dark: #e6ecf6;
  --card: #ffffff;
  --brand: #1d3a5f;
  --brand-soft: #dfe7f2;
  --gold: #b89a5a;
  --gold-txt: #7a5d22;
  --muted: #6e6659;
  --rule: #d3dcea;
  --ok: #2f6b3a;
  --ok-bg: #e3efe4;
  --warn: #8a5d10;
  --warn-bg: #f7ecd6;
  --stop: #8d3a2e;
  --stop-bg: #f6e2de;
  --nav-h: 72px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 58, 95, .06), 0 10px 26px -20px rgba(29, 58, 95, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: calc(var(--nav-h) + 28px) 20px 64px; }
main.large { max-width: 1240px; }

/* ───────────────────────────── En-tête ───────────────────────────── */
.vj-head { text-align: center; margin-bottom: 32px; }
.vj-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-txt); margin-bottom: 10px;
}
.vj-head h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600; font-size: clamp(34px, 6vw, 56px); line-height: 1.06;
  text-wrap: balance; margin-bottom: 12px;
}
.vj-lead { max-width: 62ch; margin: 0 auto; color: var(--muted); font-size: 16px; line-height: 1.6; }

/* ───────────────────────────── Onglets ───────────────────────────── */
.vj-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 30px 0 26px; padding: 6px; background: var(--paper-dark);
  border-radius: 999px; width: fit-content; margin-inline: auto; max-width: 100%;
}
.vj-tab {
  border: none; background: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--muted); padding: 9px 20px; border-radius: 999px; transition: background .15s, color .15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.vj-tab:hover { color: var(--ink); }
.vj-tab[aria-selected="true"] { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }
.vj-tab .n {
  font-size: 11px; font-weight: 600; background: var(--brand-soft); color: var(--brand);
  border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums;
}
.vj-tab[aria-selected="true"] .n { background: var(--brand); color: #fff; }

/* ───────────────────────────── Cartes de jeu ───────────────────────────── */
.vj-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.vj-card {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 9px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.vj-card:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 6px 22px -12px rgba(29, 58, 95, .45); }
a.vj-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.vj-card-top { display: flex; align-items: center; gap: 10px; }
.vj-card-emoji { font-size: 26px; line-height: 1; }
.vj-card-theme {
  font-size: 10px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); margin-left: auto;
}
.vj-card-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 23px; font-weight: 600; line-height: 1.2; }
.vj-card-desc { font-size: 14px; color: var(--muted); line-height: 1.5; flex: 1; }
.vj-card-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 10px;
}
.vj-card-foot .auteur { font-weight: 500; color: var(--ink); }

/* Pastilles de statut : la forme dit l'état, pas seulement la couleur. */
.vj-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px;
}
.vj-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.vj-chip.brouillon { color: var(--muted); background: var(--paper-dark); }
.vj-chip.soumis    { color: var(--warn); background: var(--warn-bg); }
.vj-chip.publie    { color: var(--ok);   background: var(--ok-bg); }
.vj-chip.retire    { color: var(--muted); background: var(--paper-dark); }
.vj-chip.refuse    { color: var(--stop); background: var(--stop-bg); }
.vj-chip.revision  { color: var(--brand); background: var(--brand-soft); }

/* ───────────────────────────── Boutons ───────────────────────────── */
.vj-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  padding: 10px 20px; border-radius: 999px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; text-decoration: none;
  transition: filter .15s, transform .1s;
}
.vj-btn:hover { filter: brightness(1.12); }
.vj-btn:active { transform: translateY(1px); }
.vj-btn:focus-visible { outline: 2px solid var(--gold-txt); outline-offset: 3px; }
.vj-btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.vj-btn.ghost { background: transparent; color: var(--brand); }
.vj-btn.ghost:hover { background: var(--brand-soft); filter: none; }
.vj-btn.danger { background: transparent; border-color: var(--stop); color: var(--stop); }
.vj-btn.danger:hover { background: var(--stop-bg); filter: none; }
.vj-btn.small { font-size: 13px; padding: 7px 15px; }

.vj-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 26px; }

/* ───────────────────────────── Encarts ───────────────────────────── */
.vj-note {
  background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; margin: 20px 0;
  font-size: 14.5px; line-height: 1.6; color: inherit;
}
.vj-note strong { font-weight: 600; }
.vj-note.ok   { border-left-color: var(--ok); }
.vj-note.warn { border-left-color: var(--warn); }
.vj-note.stop { border-left-color: var(--stop); }
.vj-note-title {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--gold-txt); margin-bottom: 6px;
}

.vj-empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.vj-empty p { margin-bottom: 16px; max-width: 46ch; margin-inline: auto; line-height: 1.6; }

/* ───────────────────────────── Formulaires ───────────────────────────── */
.vj-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.vj-field > label { font-size: 13px; font-weight: 600; }
.vj-field .aide { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.vj-field input[type=text], .vj-field textarea, .vj-field select, .vj-input {
  font: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--rule);
  border-radius: 9px; background: var(--card); color: var(--ink); width: 100%;
}
.vj-field textarea { min-height: 150px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.vj-field input:focus, .vj-field textarea:focus, .vj-field select:focus, .vj-input:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.vj-row { display: flex; flex-wrap: wrap; gap: 16px; }
.vj-row > * { flex: 1 1 200px; }

.vj-panel {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.vj-panel > h2 {
  font-family: 'Cormorant Garamond', Georgia, serif; font-size: 26px; font-weight: 600;
  margin-bottom: 6px; line-height: 1.2;
}
.vj-panel > .sous { font-size: 14px; color: var(--muted); margin-bottom: 18px; line-height: 1.55; }

/* Étapes numérotées de l'outil de création : la numérotation encode une vraie
   séquence (on ne peut pas arbitrer des critères avant d'avoir des données). */
.vj-step { counter-increment: etape; }
.vj-step > h2::before {
  content: counter(etape); display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-right: 12px; border-radius: 50%;
  background: var(--brand); color: #fff; font-family: 'Montserrat', sans-serif;
  font-size: 14px; font-weight: 600; vertical-align: 3px;
}
.vj-steps { counter-reset: etape; }

/* ───────────────────────────── Tableau de données ───────────────────────────── */
.vj-table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; background: var(--card); }
.vj-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.vj-table th, .vj-table td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.vj-table thead th { background: var(--paper-dark); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.vj-table tbody tr:last-child td { border-bottom: none; }
.vj-table td.num { text-align: right; }
.vj-table select { font: inherit; font-size: 12px; padding: 3px 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: var(--ink); }

/* ───────────────────────────── Témoin de faisabilité ───────────────────────────── */
.vj-feu {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: 12px; border: 1px solid var(--rule); background: var(--card);
  margin-bottom: 16px;
}
.vj-feu .lampe { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.vj-feu.vert   { border-color: var(--ok);   background: var(--ok-bg); }
.vj-feu.vert   .lampe { background: var(--ok); }
.vj-feu.orange { border-color: var(--warn); background: var(--warn-bg); }
.vj-feu.orange .lampe { background: var(--warn); }
.vj-feu.rouge  { border-color: var(--stop); background: var(--stop-bg); }
.vj-feu.rouge  .lampe { background: var(--stop); }
.vj-feu .txt { flex: 1 1 260px; font-size: 14px; line-height: 1.5; }
.vj-feu .mesures { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.vj-feu .mesures b { display: block; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ───────────────────────────── Liste des critères ───────────────────────────── */
/* La liste des critères est COMPLÈTE : aucune hauteur bornée, on doit tout voir. */
.vj-crits { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); padding-right: 4px; }
.vj-crit { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--paper-dark); font-size: 13px; }
.vj-crit input[type=checkbox] { flex: none; width: 16px; height: 16px; accent-color: var(--brand); }
.vj-crit .lab { flex: 1; min-width: 0; }
.vj-crit .lab input { width: 100%; font: inherit; font-size: 13px; border: 1px solid transparent; background: transparent; border-radius: 5px; padding: 2px 5px; color: inherit; }
.vj-crit .lab input:hover { border-color: var(--rule); background: var(--card); }
.vj-crit .lab input:focus { outline: 2px solid var(--brand); background: var(--card); }
.vj-crit .n { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.vj-crit.off { opacity: .5; }
.vj-crit-dim { grid-column: 1 / -1; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-txt); margin-top: 10px; }

/* ───────────────────────────── Grille de sudoku ───────────────────────────── */
.sk-grid { display: grid; grid-template-columns: minmax(120px, 1.2fr) repeat(3, 1fr); gap: 6px; margin: 0 auto; max-width: 760px; }
.sk-h { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px 6px; font-size: 12.5px; font-weight: 500; line-height: 1.3; background: var(--brand-soft); color: var(--brand); border-radius: 9px; min-height: 58px; }
.sk-h.corner { background: transparent; }
.sk-h.row { text-align: left; justify-content: flex-start; }
.sk-cell {
  min-height: 76px; border: 1px solid var(--rule); border-radius: 9px; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px; cursor: pointer; text-align: center; font: inherit; color: inherit;
  transition: border-color .15s, background .15s;
}
.sk-cell:hover:not(.done) { border-color: var(--brand); background: var(--brand-soft); }
.sk-cell:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sk-cell.done { background: var(--ok-bg); border-color: var(--ok); cursor: default; }
.sk-cell.active { border-color: var(--gold); border-width: 2px; }
.sk-cell .rep { font-size: 13px; font-weight: 500; line-height: 1.25; }
.sk-cell .plus { font-size: 22px; color: var(--muted); }
/* Une réponse ou un critère peut être un mot long : on coupe plutôt que de
   pousser la colonne et faire déborder la grille de la page. */
.sk-h, .sk-cell { min-width: 0; overflow-wrap: anywhere; }

/* ─────────── Corrigé : la même grille, relue ─────────── */
/* Le créateur, sous le titre du jeu. */
.vj-auteur { font-size: 14px; color: var(--muted); margin-top: -6px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.vj-auteur a { color: var(--gold-txt); text-decoration: none; border-bottom: 1px solid rgba(184, 154, 90, .45); }
.vj-auteur a:hover { border-bottom-color: var(--gold-txt); }
.vj-auteur img { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; }

.corr-note { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 12px; }
.sk-grid--corr { margin-bottom: 4px; }
.sk-cell.corr { cursor: pointer; }
.sk-cell.corr:hover { border-color: var(--brand); }
.sk-cell.corr.done { background: var(--ok-bg); border-color: var(--ok); cursor: pointer; }
.sk-cell.corr.revealed { background: var(--paper-dark); border-color: var(--rule); }
.sk-cell.corr.missed { background: var(--stop-bg); border-color: var(--stop); }
.corr-tag {
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  color: var(--muted);
}
.sk-cell.corr.done .corr-tag { color: var(--ok); }

/* ─────────── Fenêtre des réponses possibles ─────────── */
.vjm { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 18px; }
.vjm[hidden] { display: none; }
.vjm-fond { position: absolute; inset: 0; background: rgba(20, 22, 28, .55); }
.vjm-boite {
  position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  width: min(520px, 100%); max-height: min(78vh, 640px); overflow: auto; padding: 22px 22px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}
.vjm-fermer {
  position: absolute; top: 8px; right: 10px; border: none; background: transparent; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: 8px;
}
.vjm-fermer:hover { color: var(--ink); background: var(--paper-dark); }
/* Les deux critères l'un SOUS l'autre, le × entre eux : mis côte à côte, un
   libellé long passait à la ligne et le × se retrouvait pendu au bout du
   premier, comme s'il lui appartenait. */
.vjm-crit {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 500; color: var(--brand); text-align: center; padding: 0 26px;
}
.vjm-crit span { background: var(--brand-soft); border-radius: 8px; padding: 5px 9px; max-width: 100%; overflow-wrap: anywhere; }
.vjm-crit .vjm-x { background: transparent; color: var(--muted); padding: 0; font-size: 15px; }
.vjm-count { font-size: 12px; color: var(--muted); text-align: center; margin: 12px 0 8px; }
.vjm-ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.vjm-ul li { font-size: 14px; padding: 7px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.vjm-ul li:nth-child(odd) { background: var(--paper-dark); }
.vjm-ul li.is-mine { background: var(--ok-bg); font-weight: 600; }
.vjm-you { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); font-weight: 600; }

/* ───────────────────────────── Quiz ───────────────────────────── */
.qz-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.qz-media {
  width: 100%; max-width: 560px; min-height: 240px; display: flex; align-items: center; justify-content: center;
  background: var(--paper-dark); border-radius: var(--radius); padding: 20px; overflow: hidden;
}
.qz-media img { max-width: 100%; max-height: 380px; width: auto; height: auto; object-fit: contain; border-radius: 8px; }
.qz-texte { font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(24px, 4vw, 38px); line-height: 1.25; text-align: center; text-wrap: balance; }
.qz-choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); width: 100%; max-width: 720px; }
.qz-choice {
  display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--card); font: inherit; font-size: 14px;
  cursor: pointer; text-align: left; color: inherit; transition: border-color .12s, background .12s;
}
.qz-choice:hover { border-color: var(--brand); }
.qz-choice:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.qz-choice .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.qz-choice.is-correct { background: var(--ok-bg); border-color: var(--ok); }
.qz-choice.is-wrong   { background: var(--stop-bg); border-color: var(--stop); }
.qz-choices.locked { pointer-events: none; }

.qz-bar { display: flex; gap: 20px; justify-content: center; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qz-bar b { color: var(--ink); font-weight: 600; }

.qz-credit { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.4; }
.qz-credit a { color: var(--gold-txt); }

/* ───────────────────────────── Résultat & classement ───────────────────────────── */
.vj-score { text-align: center; margin-bottom: 22px; }
.vj-score .big { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 64px; font-weight: 600; line-height: 1; color: var(--brand); }
.vj-score .big small { font-size: 26px; color: var(--muted); }
.vj-score .tps { font-size: 15px; color: var(--muted); margin-top: 6px; }

.vj-board { width: 100%; border-collapse: collapse; font-size: 14px; }
.vj-board th, .vj-board td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: left; }
.vj-board thead th { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.vj-board td.num { text-align: right; font-variant-numeric: tabular-nums; }
.vj-board tr.moi { background: var(--brand-soft); font-weight: 600; }
.vj-board .av { width: 24px; height: 24px; border-radius: 50%; vertical-align: middle; margin-right: 7px; }

.vj-msg { text-align: center; font-size: 14px; color: var(--muted); margin: 14px 0; min-height: 1.4em; }
.vj-msg a { color: var(--gold-txt); }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ───────────────────────────── Recherche Commons ───────────────────────────── */
.cm-results { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); margin-top: 12px; max-height: 320px; overflow-y: auto; }
.cm-hit { border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--card); cursor: pointer; padding: 0; }
.cm-hit img { width: 100%; height: 90px; object-fit: cover; display: block; }
.cm-hit .t { font-size: 10.5px; padding: 5px 6px; color: var(--muted); line-height: 1.3; word-break: break-word; }
.cm-hit:hover { border-color: var(--brand); }
.cm-hit:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cm-hit.pick { border-color: var(--ok); border-width: 2px; }

/* ───────────────────────────── Fenêtre modale ───────────────────────────── */
.vj-modal { position: fixed; inset: 0; background: rgba(26, 24, 20, .55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1200; }
.vj-modal-box { background: var(--card); border-radius: var(--radius); padding: 24px; max-width: 560px; width: 100%; max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .5); }
.vj-modal-box h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 25px; font-weight: 600; margin-bottom: 12px; }

@media (max-width: 620px) {
  .sk-grid { grid-template-columns: minmax(84px, 1fr) repeat(3, 1fr); gap: 4px; }
  .sk-h { font-size: 11px; padding: 6px 4px; min-height: 52px; }
  .sk-cell { min-height: 66px; }
  .vj-panel { padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ───────────────────────── Mémo des types de colonnes ───────────────────────── */
.vj-memo td { white-space: normal; vertical-align: top; }
.vj-memo td:first-child { white-space: nowrap; }
.vj-memo em { color: var(--muted); font-style: italic; }

/* ───────────────────────── Grille modifiable ───────────────────────── */
.vj-grille-barre {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; font-size: 13px; color: var(--muted);
}
.vj-grille-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.vj-grille { max-height: 460px; overflow: auto; }
.vj-grille thead th { position: sticky; top: 0; z-index: 2; }
.vj-grille th { min-width: 150px; vertical-align: top; }
.vj-grille td input[type=text],
.vj-grille .vj-col-nom {
  font: inherit; font-size: 13px; width: 100%; min-width: 110px;
  border: 1px solid transparent; background: transparent; border-radius: 5px;
  padding: 3px 6px; color: inherit;
}
.vj-grille .vj-col-nom { font-weight: 600; text-transform: none; letter-spacing: 0; margin-bottom: 4px; }
.vj-grille td input[type=text]:hover, .vj-grille .vj-col-nom:hover { border-color: var(--rule); background: var(--card); }
.vj-grille td input[type=text]:focus, .vj-grille .vj-col-nom:focus { outline: 2px solid var(--brand); background: var(--card); }
.vj-grille th select { width: 100%; }
.vj-grille td { padding: 2px 6px; }
.vj-grille .vj-num { color: var(--muted); font-size: 11px; text-align: right; width: 1%; white-space: nowrap; }
.vj-x {
  border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 13px; line-height: 1; padding: 2px 5px; border-radius: 4px;
}
.vj-x:hover { color: var(--stop); background: var(--stop-bg); }
.vj-x:focus-visible { outline: 2px solid var(--brand); }

/* ───────────────────────── Liste des critères ───────────────────────── */
.vj-crit.mort { opacity: .42; }
.vj-crit.mort .lab { padding: 2px 5px; }
.vj-dim-n { font-weight: 400; color: var(--muted); letter-spacing: 0; text-transform: none; }

/* ══════════════════════════════════════════════════════════════════════════
   COLORIAGE (3e type de jeu) — création + lecteur.
   Le lecteur reprend le moteur des « Coloriages magiques » : on porte ici les
   styles .col-* nécessaires (le jeu vit sous .ugc-host / .ugc-app). Pas de
   sélecteur, pas de surcouche de verrou (une seule grille, sans compte).
   ══════════════════════════════════════════════════════════════════════════ */
.ugc-app, .ugc-host { --line: #d9dfea; }
.ugc-host { max-width: 1080px; margin: 0 auto; }

/* ── création : choix du dessin ── */
.ugc-creer { margin-top: .4rem; }
.ugc-c-block { margin: 0 0 1.6rem; }
.ugc-c-h { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; font-weight: 600; color: var(--brand); margin-bottom: .3rem; }
.ugc-draws { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; margin: .6rem 0; }
.ugc-draw-tile {
  display: flex; flex-direction: column; gap: .25rem; padding: .5rem; border: 1.5px solid var(--rule);
  background: var(--card); border-radius: 12px; cursor: pointer; text-align: left; color: var(--ink);
  font-family: Montserrat, sans-serif; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.ugc-draw-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow); }
.ugc-draw-tile.is-sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.ugc-draw-thumb { display: block; width: 100%; border-radius: 8px; overflow: hidden; background: var(--paper-dark); min-height: 90px; }
.ugc-draw-thumb canvas { display: block; width: 100%; height: auto; border-radius: 8px; }
.ugc-draw-name { font-size: .9rem; font-weight: 600; line-height: 1.2; }
.ugc-draw-lvl { font-size: .76rem; color: var(--muted); }
.ugc-upload { margin-top: .4rem; }
.ugc-upload-det > summary { cursor: pointer; font-family: Montserrat, sans-serif; font-size: .9rem; color: var(--gold-txt); padding: .4rem 0; font-weight: 600; }
.ugc-genprev, .ugc-prevhost { margin-top: .6rem; }
.ugc-genprev canvas, .ugc-prevhost canvas { display: block; border-radius: 10px; border: 1px solid var(--rule); box-shadow: var(--shadow); }

/* ── lecteur : scène (repris de coloriage.css) ── */
.col-stage { display: flex; gap: 1.3rem; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.col-canvas-wrap {
  position: relative; overflow: hidden; flex: 1 1 340px; max-width: 640px; min-width: 280px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  box-shadow: 0 6px 20px rgba(20,24,40,.06); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.col-canvas { width: 100%; height: auto; border-radius: 8px; touch-action: none; display: block; }
.col-side { flex: 0 1 320px; min-width: 240px; }
.col-legend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .4rem; }
.col-legend-title { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.col-legend { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; }
@media (max-width: 520px) { .col-legend { grid-template-columns: 1fr; } }
.col-lrow {
  display: flex; align-items: center; gap: .5rem; padding: .32rem .45rem; border: 1.5px solid var(--line);
  background: var(--card); border-radius: 9px; cursor: pointer; text-align: left; width: 100%;
  font-family: Montserrat, sans-serif; font-size: .86rem; color: var(--ink); transition: border-color .1s, background .1s;
}
.col-lrow:hover { border-color: var(--gold); }
.col-lrow.is-sel { border-color: var(--gold); background: #fbf6ea; box-shadow: 0 0 0 2px rgba(184,154,90,.25); }
.col-lrow.is-done { border-color: #2f8f5b; background: #eef8f1; cursor: default; box-shadow: none; }
.col-lrow.is-done:hover { border-color: #2f8f5b; }
.col-lrow.is-done .col-lname { color: #2f8f5b; }
.col-lrow.is-done .col-lname::after { content: ' ✓'; font-weight: 700; }
.col-lrow.is-done .col-sw { box-shadow: 0 0 0 2px #2f8f5b; }
.col-stage.col-fs .col-lrow.is-done { background: #1e2a22; border-color: #2f8f5b; }
.col-stage.col-fs .col-lrow.is-done .col-lname { color: #7fd0a0; }
.col-sw { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; border: 1.5px solid rgba(0,0,0,.28); }
.col-lname { line-height: 1.15; }
.col-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.col-clear, .col-replay, .col-tool {
  font-family: Montserrat, sans-serif; font-size: .84rem; padding: .5rem .7rem; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink);
}
.col-clear:hover, .col-replay:hover, .col-tool:hover:not(:disabled) { border-color: var(--gold); }
.col-clear.is-active, .col-tool.is-active { border-color: var(--gold); background: #fbf6ea; }
.col-tool:disabled { opacity: .45; cursor: default; }
.col-curdot { display: none; }
.col-count {
  display: inline-flex; align-items: center; padding: .5rem .7rem; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--muted);
  font-family: Montserrat, sans-serif; font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.col-count.is-done { border-color: #2f8f5b; color: #2f8f5b; background: #eef8f1; font-weight: 600; }
.col-msg { margin: 1rem auto 0; max-width: 760px; text-align: center; }
.col-hint { font-family: Montserrat, sans-serif; color: var(--muted); font-size: .9rem; line-height: 1.4; }

/* bandeau de victoire (sous le dessin), toast, boutons */
.col-winbanner {
  position: static; width: 100%; margin-top: 10px; box-sizing: border-box;
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; justify-content: center;
  padding: .6rem .9rem; border-radius: 12px;
  background: rgba(251,246,234,.98); border: 1.5px solid var(--gold); box-shadow: 0 6px 20px rgba(20,24,40,.16);
  animation: colpop .3s ease; font-family: Montserrat, sans-serif;
}
@keyframes colpop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.col-winbar-emoji { font-size: 1.7rem; }
.col-winbar-txt { flex: 1 1 260px; font-size: .92rem; color: var(--ink); line-height: 1.35; }
.col-winbar-txt em { font-style: italic; color: var(--gold-txt); font-weight: 600; }
.col-btn {
  display: inline-block; margin: .25rem .2rem; padding: .55rem .9rem; border-radius: 9px; border: none; cursor: pointer;
  background: var(--gold); color: #fff; font-family: Montserrat, sans-serif; font-size: .88rem; text-decoration: none;
}
.col-btn:hover { filter: brightness(1.06); }
.col-winbar-close {
  display: none; position: absolute; top: 6px; right: 8px;
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line);
  background: rgba(255,255,255,.9); color: var(--ink); cursor: pointer;
  font-size: .9rem; line-height: 1; align-items: center; justify-content: center; padding: 0;
}
.col-winbar-close:hover { border-color: var(--gold); }
.col-stage.col-fs .col-winbanner { position: absolute; left: 12px; right: 12px; bottom: 12px; width: auto; margin: 0; z-index: 6; padding-right: 2.2rem; }
.col-stage.col-fs .col-winbar-close { display: inline-flex; }
.col-toast {
  position: absolute; top: 16px; left: 50%; transform: translate(-50%, -8px); z-index: 7;
  background: rgba(26,24,20,.92); color: #fff; padding: .5rem .95rem; border-radius: 999px;
  font-family: Montserrat, sans-serif; font-size: .95rem; font-weight: 500; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.28); opacity: 0; transition: opacity .3s ease, transform .3s ease; pointer-events: none;
}
.col-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* contrôles zoom / plein écran, poignée déplaçable/masquable */
.col-viewctrl { position: absolute; top: 14px; right: 14px; z-index: 4; display: flex; gap: .3rem; touch-action: none; }
.col-viewctrl button {
  width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--line);
  background: rgba(255,255,255,.93); color: var(--ink); cursor: pointer;
  font-size: 1.05rem; line-height: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(20,24,40,.14); padding: 0;
}
.col-viewctrl button:hover:not(:disabled) { border-color: var(--gold); }
.col-viewctrl button:disabled { opacity: .4; cursor: default; }
.col-vc-toggle { cursor: grab; touch-action: none; font-size: .95rem !important; }
.col-vc-toggle:active { cursor: grabbing; }
.col-viewctrl.is-collapsed { background: transparent; }
.col-viewctrl.is-collapsed button:not(.col-vc-toggle) { display: none; }
.col-viewctrl.is-collapsed .col-vc-toggle { opacity: .8; }

/* plein écran (réel ou pseudo iOS) */
.col-stage.col-fs {
  position: fixed; inset: 0; z-index: 5000; margin: 0; padding: 12px; gap: 12px;
  background: #0e1116; flex-wrap: nowrap; align-items: stretch; justify-content: stretch;
}
.col-stage.col-fs .col-canvas-wrap { flex: 1 1 auto; max-width: none; min-width: 0; margin: 0; align-items: center; justify-content: center; background: #171b22; border-color: #2a303c; }
.col-stage.col-fs .col-canvas { width: auto; height: auto; }
.col-stage.col-fs .col-side { flex: 0 0 258px; min-width: 0; max-height: 100%; overflow: auto; background: #171b22; border: 1px solid #2a303c; border-radius: 14px; padding: 12px; color: #e8eaf0; }
.col-stage.col-fs .col-legend-title { color: #f0f2f7; }
.col-stage.col-fs .col-lrow,
.col-stage.col-fs .col-tool,
.col-stage.col-fs .col-clear,
.col-stage.col-fs .col-replay,
.col-stage.col-fs .col-count { background: #20252e; border-color: #39414f; color: #e8eaf0; }
.col-stage.col-fs .col-lrow.is-sel,
.col-stage.col-fs .col-tool.is-active,
.col-stage.col-fs .col-clear.is-active { border-color: var(--gold); background: #2c2a20; }
.col-stage.col-fs .col-count.is-done { border-color: #2f8f5b; color: #7fd0a0; background: #1e2a22; }
@media (max-width: 680px) {
  .col-stage.col-fs { flex-direction: column; }
  .col-stage.col-fs .col-side { flex: 0 0 auto; max-height: 38vh; }
}
