/* ============================================================
 *  Mots-Cachés — Feuille de style principale
 *  Fichier : /home/debian/site/assets/css/style.css
 *  Approche : mobile-first, variables CSS, aucune dépendance
 * ============================================================ */

/* ------------------------------------------------------------
 * 1. RESET MINIMAL
 * ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body, h1, h2, h3, h4, h5, h6,
p, ul, ol, li, figure, blockquote, dl, dd, hr {
  margin: 0;
  padding: 0;
}

ul, ol { list-style: none; }

img, svg, video { display: block; max-width: 100%; height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }


/* ------------------------------------------------------------
 * FIX MOBILE — Empêche le débordement horizontal
 * ---------------------------------------------------------- */
html {
  overflow-x: hidden;
}
body {
  overflow-x: hidden;
  /* La vraie contrainte est sur les enfants via min-width:0 */
}
/* Les éléments qui pourraient déborder sont contenus */
img, svg, video, iframe, table, pre, code {
  max-width: 100%;
}
/* Les mots très longs sont coupés (ex : PAMPLEMOUSSE) */
.card-title, .card-subtitle, .word-link-word, .defi-card-title, .blog-card-title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ------------------------------------------------------------
 * 2. VARIABLES — THÈME CLAIR (par défaut)
 * ---------------------------------------------------------- */
:root {
  /* Couleurs de marque */
  --brand:        #3b82f6;
  --brand-dark:   #2563eb;
  --brand-light:  #dbeafe;
  --accent:       #8b5cf6;
  --success:      #16a34a;
  --warning:      #f59e0b;
  --danger:       #dc2626;

  /* Surfaces */
  --bg:           #ffffff;
  --bg-soft:      #f8fafc;
  --bg-muted:     #f1f5f9;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;

  /* Texte */
  --text:         #0f172a;
  --text-soft:    #475569;
  --text-muted:   #64748b;
  --text-invert:  #ffffff;

  /* Bordures */
  --border:       #e2e8f0;
  --border-strong:#cbd5e1;

  /* États */
  --focus:        #2563eb;
  --link:         #2563eb;
  --link-hover:   #1d4ed8;

  /* Grille de jeu */
  --case-bg:      #ffffff;
  --case-bg-alt:  #f8fafc;
  --case-border:  #e2e8f0;
  --case-text:    #0f172a;
  --case-selected:#dbeafe;
  --case-found:   #bbf7d0;
  --case-found-text:#166534;
  --case-hint:    #fef3c7;

  /* Ombres */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow:    0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);

  /* Rayons */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Espacements fluides */
  --gap-xs: .25rem;
  --gap-sm: .5rem;
  --gap:    1rem;
  --gap-lg: 1.5rem;
  --gap-xl: 2.5rem;

  /* Typographie fluide */
  --fs-xs:   clamp(.75rem, .72rem + .15vw, .8125rem);
  --fs-sm:   clamp(.875rem, .85rem + .15vw, .9375rem);
  --fs-base: clamp(1rem, .95rem + .2vw, 1.0625rem);
  --fs-lg:   clamp(1.125rem, 1.05rem + .35vw, 1.25rem);
  --fs-xl:   clamp(1.25rem, 1.15rem + .5vw, 1.5rem);
  --fs-2xl:  clamp(1.5rem, 1.35rem + .75vw, 2rem);
  --fs-3xl:  clamp(1.875rem, 1.6rem + 1.2vw, 2.75rem);

  /* Transitions */
  --t-fast: 120ms ease;
  --t:      200ms ease;
  --t-slow: 320ms ease;

  /* Conteneur */
  --container: 1200px;

  color-scheme: light;
}

/* ------------------------------------------------------------
 * 3. VARIABLES — THÈME SOMBRE
 * ---------------------------------------------------------- */
[data-theme="dark"] {
  --brand:        #60a5fa;
  --brand-dark:   #3b82f6;
  --brand-light:  #1e293b;
  --accent:       #a78bfa;
  --success:      #22c55e;
  --warning:      #fbbf24;
  --danger:       #f87171;

  --bg:           #0b1220;
  --bg-soft:      #0f172a;
  --bg-muted:     #1e293b;
  --surface:      #111a2e;
  --surface-2:    #0f172a;

  --text:         #e6edf6;
  --text-soft:    #c2cbd9;
  --text-muted:   #94a3b8;
  --text-invert:  #0b1220;

  --border:       #1e293b;
  --border-strong:#334155;

  --focus:        #60a5fa;
  --link:         #60a5fa;
  --link-hover:   #93c5fd;

  --case-bg:      #111a2e;
  --case-bg-alt:  #0f172a;
  --case-border:  #24334a;
  --case-text:    #e6edf6;
  --case-selected:#1e3a5f;
  --case-found:   #14532d;
  --case-found-text:#bbf7d0;
  --case-hint:    #78350f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 4px 12px rgba(0, 0, 0, .5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);

  color-scheme: dark;
}

/* ------------------------------------------------------------
 * 4. BASE
 * ---------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t), color var(--t);
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
}
h1 { font-size: var(--fs-3xl); margin-bottom: var(--gap); }
h2 { font-size: var(--fs-2xl); margin: var(--gap-xl) 0 var(--gap); }
h3 { font-size: var(--fs-xl);  margin: var(--gap-lg) 0 var(--gap-sm); }
h4 { font-size: var(--fs-lg);  margin: var(--gap) 0 var(--gap-xs); }

p { margin-bottom: var(--gap); }

a:not([class]) {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--t-fast);
}
a:not([class]):hover { color: var(--link-hover); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------
 * 5. UTILITAIRES
 * ---------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

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

.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  padding: .75rem 1rem;
  background: var(--brand);
  color: var(--text-invert);
  border-radius: var(--radius);
  font-weight: 600;
  transition: top var(--t);
}
.skip-link:focus { top: 1rem; }

/* ------------------------------------------------------------
 * 6. HEADER
 * ---------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: var(--fs-lg);
  color: var(--text);
  white-space: nowrap;
}
.logo-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  border-radius: var(--radius);
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.logo-text { letter-spacing: -.02em; }

/* --- Navigation principale --- */
.primary-nav { margin-left: auto; }

.primary-nav ul {
  display: flex;
  gap: var(--gap-sm);
}

.primary-nav a {
  display: inline-flex;
  align-items: center;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-soft);
  transition: background var(--t-fast), color var(--t-fast);
}
.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  background: var(--bg-muted);
  color: var(--text);
}

/* --- Menu déroulant (Niveaux) --- */
.has-dropdown { position: relative; }

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.dropdown-toggle:hover,
.dropdown-toggle[aria-expanded="true"] {
  background: var(--bg-muted);
  color: var(--text);
}
.dropdown-toggle .chev {
  transition: transform var(--t);
  opacity: .7;
}
.dropdown-toggle[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  padding: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  flex-direction: column;
  gap: 2px;
  /* Fermé par défaut : masqué + retiré du parcours clavier (via JS) */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
}
.has-dropdown.is-open .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown a {
  display: block;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-soft);
}
.dropdown a:hover,
.dropdown a:focus-visible {
  background: var(--bg-muted);
  color: var(--text);
}

/* --- Recherche header --- */
.header-tools {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-left: var(--gap);
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 0 .25rem 0 .875rem;
  transition: border-color var(--t), background var(--t);
}
.header-search:focus-within {
  border-color: var(--brand);
  background: var(--surface);
}
.header-search input {
  width: 100px;
  padding: .55rem 0;
  background: none;
  border: 0;
  outline: 0;
  font-size: var(--fs-sm);
  transition: width var(--t);
}
.header-search input:focus { width: 200px; }
.header-search button {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.header-search button:hover { background: var(--surface-2); color: var(--text); }

/* --- Toggle thème --- */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--text-soft);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t);
}
.theme-toggle:hover { background: var(--bg-muted); color: var(--text); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { grid-area: 1 / 1; transition: opacity var(--t), transform var(--t); }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg); }
[data-theme="dark"]  .theme-toggle .icon-sun  { opacity: 0; transform: rotate(90deg); }
[data-theme="dark"]  .theme-toggle .icon-moon { opacity: 1; transform: rotate(0); }

/* --- Burger (caché en desktop) --- */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  position: relative;
}
.nav-toggle-bar {
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 2px;
  background: var(--text);
  transform: translate(-50%, -50%);
  transition: transform var(--t), opacity var(--t);
}
.nav-toggle-bar:nth-child(1) { transform: translate(-50%, -8px); }
.nav-toggle-bar:nth-child(3) { transform: translate(-50%,  6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translate(-50%, -50%) rotate(-45deg); }

/* ------------------------------------------------------------
 * 7. FIL D'ARIANE
 * ---------------------------------------------------------- */
.breadcrumb {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding-block: .75rem;
}
.breadcrumb li + li::before {
  content: "›";
  margin-right: .5rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-soft); }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; }

/* ------------------------------------------------------------
 * 8. BOUTONS
 * ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: .625rem 1.125rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast),
              box-shadow var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-muted); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }

/* ------------------------------------------------------------
 * 9. CARTES (grilles & thèmes)
 * ---------------------------------------------------------- */
.card-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  color: var(--text);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.card:active { transform: translateY(0); }

.card-cover {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 2.5rem;
}

.card-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: 1.25;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  margin-top: auto;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.card-meta span { display: inline-flex; align-items: center; gap: .25rem; }

/* Date d'ajout sur les cartes */
.card-date {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: .25rem;
  opacity: .85;
}
.card-date svg { flex-shrink: 0; opacity: .7; }
.card-date time { font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-soft);
}
.badge--facile    { background: #dcfce7; color: #166534; }
.badge--moyen     { background: #fef9c3; color: #854d0e; }
.badge--difficile { background: #ffedd5; color: #9a3412; }
.badge--expert    { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge--facile    { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge--moyen     { background: #422006; color: #fde68a; }
[data-theme="dark"] .badge--difficile { background: #431407; color: #fdba74; }
[data-theme="dark"] .badge--expert    { background: #450a0a; color: #fecaca; }

/* ------------------------------------------------------------
 * 10. GRILLE DE JEU (mots mêlés)
 * ---------------------------------------------------------- */
.game-wrap {
  display: grid;
  /* En mobile : une seule colonne minmax(0, 1fr) = largeur contrainte
     au viewport, JAMAIS à la largeur intrinsèque des enfants. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap-lg);
  align-items: start;
  margin-block: var(--gap-lg);
  max-width: 100%;
}
/* Les enfants directs ne doivent jamais imposer leur largeur au parent */
.game-wrap > * {
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 900px) {
  .game-wrap {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

/* Conteneur scrollable pour les grandes grilles (15×15 et +) */
.game-board-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  /* Le scroll se fait sur le padding (en dehors des cases) */
  touch-action: pan-x pan-y;
  scroll-behavior: smooth;
}

.game-board {
  display: grid;
  gap: 2px;
  width: 100%;
  /* Largeur fluide : 640px sur petit écran, 900px sur desktop */
  max-width: min(100%, 900px);
  margin-inline: auto;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  user-select: none;
  -webkit-user-select: none;
  /* Le JS capture le drag pour tracer les mots.
     Le scroll se fait via les boutons de navigation. */
  touch-action: none;
  grid-template-columns: repeat(var(--cols, 10), minmax(0, 1fr));
}

/* Sur mobile, les grandes grilles débordent horizontalement avec scroll.
   Largeur minimale de case = 24px pour la lisibilité. */
@media (max-width: 899.98px) {
  .game-board[data-size="15"] { min-width: calc(15 * 24px); }
  .game-board[data-size="18"] { min-width: calc(18 * 24px); }
  .game-board[data-size="20"] { min-width: calc(20 * 24px); }
  .game-board[data-size="25"] { min-width: calc(25 * 22px); }
  .game-board[data-size="30"] { min-width: calc(30 * 20px); }
}

.case {
  position: relative;
  aspect-ratio: 1 / 1;
  /* Le drag de sélection empêche le scroll sur les cases */
  touch-action: none;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--case-bg);
  border: 1px solid var(--case-border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  /* Police adaptative : plus petite sur les grandes grilles */
  font-size: clamp(.55rem, calc(20vw / var(--cols, 10)), 1.15rem);
  color: var(--case-text);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast),
              transform var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.case:nth-child(even) { background: var(--case-bg-alt); }

.case:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.case.is-selected { background: var(--case-selected); }
.case.is-found {
  background: var(--case-found);
  color: var(--case-found-text);
  cursor: default;
}
.case.is-hint { background: var(--case-hint); }
.case.is-error { animation: shake 260ms ease; }

@keyframes shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX( 3px); }
}

/* Liste des mots à trouver */
.mots-liste {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.mots-liste li {
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: center;
  transition: background var(--t), color var(--t), opacity var(--t);
}
.mots-liste li.is-found {
  background: var(--case-found);
  color: var(--case-found-text);
  text-decoration: line-through;
  opacity: .75;
}

/* Barre de statistiques de partie */
.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.game-stat {
  display: flex;
  flex-direction: column;
  min-width: 80px;
}
.game-stat-label { font-size: var(--fs-xs); color: var(--text-muted); }
.game-stat-value { font-size: var(--fs-lg); font-weight: 700; }

/* Zone des actions de jeu (indice, révéler, recommencer…) */
.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

/* ------------------------------------------------------------
 * 11. FORMULAIRES & RECHERCHE
 * ---------------------------------------------------------- */
.input,
select.input {
  width: 100%;
  min-height: 44px;
  padding: .625rem .875rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color var(--t), box-shadow var(--t);
}
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}

.search-hero {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: var(--gap);
}
.search-hero .input { flex: 1 1 240px; }

/* ------------------------------------------------------------
 * 12. HERO / SECTIONS DE LA HOME
 * ---------------------------------------------------------- */
.hero {
  padding-block: clamp(2rem, 6vw, 4rem);
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--brand-light) 55%, var(--bg)) 0%,
              var(--bg) 100%);
}
[data-theme="dark"] .hero {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--brand) 12%, var(--bg)) 0%,
              var(--bg) 100%);
}
.hero-inner {
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}
.hero h1 { margin-bottom: var(--gap); }
.hero p  { font-size: var(--fs-lg); color: var(--text-soft); }

.section { padding-block: var(--gap-xl); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: var(--gap-lg);
}
.section-head h2 { margin: 0; }

.grid-themes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--gap-sm);
}
.theme-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .5rem .875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.theme-chip:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: translateY(-1px);
}
.theme-chip-ico { font-size: 1.15em; }

/* ------------------------------------------------------------
 * 13. PAGINATION
 * ---------------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: .25rem;
  margin-top: var(--gap-xl);
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 .75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-sm);
  color: var(--text-soft);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.pagination a:hover { background: var(--bg-muted); border-color: var(--border-strong); }
.pagination [aria-current="page"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* ------------------------------------------------------------
 * 14. FOOTER v2 — 4 colonnes + bande thèmes + barre basse
 * ---------------------------------------------------------- */
.site-footer {
  margin-top: var(--gap-xl);
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

/* ============ PARTIE PRINCIPALE (4 colonnes) ============ */
.footer-main {
  padding-block: var(--gap-xl);
}

.footer-grid {
  display: grid;
  gap: var(--gap-xl);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
}

.footer-col h2,
.footer-title {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text);
  margin: 0 0 var(--gap-sm);
  font-weight: 700;
}

.footer-col ul { display: grid; gap: .35rem; }

.footer-col a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 30px;
  color: var(--text-soft);
  transition: color var(--t-fast), transform var(--t-fast);
}
.footer-col a:hover {
  color: var(--link);
  transform: translateX(2px);
}

/* --- Bloc marque --- */
.footer-brand .logo {
  margin-bottom: var(--gap-sm);
}
.footer-brand .logo-footer {
  font-size: var(--fs-lg);
}
.footer-tagline {
  line-height: 1.55;
  margin-bottom: var(--gap);
  max-width: 42ch;
}
/* Petit texte de présentation sous la tagline */
.footer-about {
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--text-muted);
  margin: .5rem 0 var(--gap);
  max-width: 46ch;
}
.footer-about strong {
  color: var(--text-soft);
  font-weight: 600;
}
.footer-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0;
}
.footer-stats strong {
  color: var(--text);
  font-weight: 700;
}

/* ============ BANDE THÈMES (chips horizontaux) ============ */
.footer-themes-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding-block: var(--gap-lg);
}

.footer-strip-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
}
@media (max-width: 767.98px) {
  .footer-strip-inner { flex-direction: column; align-items: flex-start; }
}

.footer-strip-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
}

.footer-strip-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.footer-theme-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .75rem;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: border-color var(--t), background var(--t),
              color var(--t), transform var(--t-fast);
}
.footer-theme-chip:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--text);
  transform: translateY(-1px);
}
.footer-theme-chip-ico { font-size: 1em; line-height: 1; }

.footer-theme-chip--all {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  color: var(--brand);
  font-weight: 600;
}
.footer-theme-chip--all:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ============ BARRE INFÉRIEURE ============ */
.footer-bottom {
  padding-block: var(--gap);
}

.footer-bottom-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.25rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
@media (max-width: 767.98px) {
  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
  }
}

.footer-copyright {
  margin: 0;
}

.footer-inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-inline-links li { display: inline; }
.footer-inline-links a {
  color: var(--text-muted);
  transition: color var(--t-fast);
}
.footer-inline-links a:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-made {
  margin: 0;
  white-space: nowrap;
}
.footer-made span { margin-left: .25rem; }
/* ------------------------------------------------------------
 * 15. BACK TO TOP
 * ---------------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--t), background var(--t), opacity var(--t);
}
.back-to-top:hover { background: var(--bg-muted); transform: translateY(-2px); }
.back-to-top[hidden] { display: none; }

/* ------------------------------------------------------------
 * 16. RESPONSIVE — MOBILE (<640px)
 * ---------------------------------------------------------- */
@media (max-width: 639.98px) {
  .nav-toggle { display: grid; }

  /* Fix bug : backdrop-filter sur .site-header casse position:fixed
     sur les navigateurs mobiles. On le retire en mobile. */
  .site-header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--bg) !important;
  }

  .primary-nav {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 99;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    width: min(320px, 85vw);
    width: min(320px, 85vw);
    margin: 0;
    padding: var(--gap-lg) var(--gap) var(--gap-lg) var(--gap-lg);
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--t-slow);
    overflow-y: auto;
  }
  .primary-nav.is-open { transform: translateX(0); }
  .primary-nav ul {
    flex-direction: column;
    gap: .25rem;
  }
  .primary-nav a {
    width: 100%;
    min-height: 48px;
    padding: .75rem 1rem;
    font-size: var(--fs-base);
  }

  /* Dropdown en accordéon sur mobile */
  .has-dropdown .dropdown {
    position: static;
    border: 0;
    box-shadow: none;
    padding: .25rem 0 .25rem 1rem;
    background: transparent;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--t-slow);
  }
  .has-dropdown.is-open .dropdown {
    max-height: 400px;
  }
  .dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .header-search input { width: 80px; }
  .header-search input:focus { width: 140px; }
  .logo-text { display: none; }
}

/* ------------------------------------------------------------
 * 17. IMPRESSION — une grille par page
 * ---------------------------------------------------------- */
@media print {
  /* Format de page : A4 portrait, marges 1,2 cm */
  @page { size: A4 portrait; margin: 1.2cm; }

  /* Éléments structurels à masquer */
  .site-header,
  .site-footer,
  .back-to-top,
  .skip-link,
  .breadcrumb,
  .hero,
  .modal,
  .no-print,
  .game-actions,
  .game-stats,
  .pagination,
  .theme-toggle,
  .header-search { display: none !important; }

  /* Base : fond blanc, texte noir, taille lisible */
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    margin: 0;
    padding: 0;
  }
  .container { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  .section {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }

  /* Titre sobre centré */
  .game-head {
    text-align: center;
    margin: 0 0 4mm !important;
  }
  .game-head h1 { font-size: 14pt !important; margin: 0 !important; }
  .game-head p  { font-size: 10pt !important; margin: 2mm 0 0 !important; }
  .game-head .badge {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid #000;
    border-radius: 3px;
    background: #fff;
    color: #000;
  }
  .game-head a { color: #000 !important; }

  /* Annule le layout 2 colonnes de la grille */
  .game-wrap {
    display: block !important;
    grid-template-columns: none !important;
    gap: 6mm !important;
    margin: 0 !important;
  }

  /* Plateau : largeur plafonnée pour tenir sur A4 */
   /* Annule le scroll horizontal en impression */
  .game-board-scroll {
    overflow: visible !important;
    width: auto !important;
  }

  /* Plateau : largeur plafonnée pour tenir sur A4 */
  .game-board {
    max-width: 15cm !important;
    min-width: 0 !important;
    margin: 0 auto 6mm !important;
    padding: 3mm !important;
    gap: 2px !important;
    background: #fff !important;
    border: 2px solid #000 !important;
    page-break-inside: avoid;
  }
  .case {
    background: #fff !important;
    border: 1px solid #666 !important;
    color: #000 !important;
    font-weight: 700;
    border-radius: 0 !important;
  }
  .case.is-found { background: #ddd !important; }
  .case.is-selected,
  .case.is-hint { background: #fff !important; }

  /* Liste des mots : pleine largeur sous la grille */
  .mots-liste {
    background: #fff !important;
    border: 1px solid #000 !important;
    padding: 3mm !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 2mm !important;
    page-break-inside: avoid;
  }
  .mots-liste li {
    background: #fff !important;
    border: 1px solid #ccc !important;
    color: #000 !important;
    padding: 2mm !important;
    font-size: 10pt;
  }
  .mots-liste li.is-found {
    background: #eee !important;
    color: #888 !important;
  }

  /* Titres généraux */
  h1 { font-size: 14pt !important; margin: 0 0 3mm !important; }
  h2, h3 { font-size: 12pt !important; margin: 4mm 0 2mm !important; }

  /* Liens : pas d'URL affichée entre parenthèses */
  a { color: #000 !important; text-decoration: none !important; }

   /* Boutons d'action masqués (mais PAS les cases de la grille) */
  .btn,
  .game-actions button:not(.case),
  .modal button { display: none !important; }

  /* --- Grandes grilles (15 à 18) : compacter légèrement --- */
  body.print-grande .game-board {
    max-width: 14cm !important;
    gap: 1px !important;
  }
  body.print-grande .case {
    font-size: 8pt !important;
  }

  /* --- Très grandes grilles (20 à 30) : compacter fortement --- */
  body.print-tres-grande .game-board {
    max-width: 13cm !important;
    gap: 1px !important;
    padding: 1mm !important;
  }
  body.print-tres-grande .case {
    font-size: 6pt !important;
  }
  body.print-tres-grande .game-head h1 {
    font-size: 11pt !important;
  }
  body.print-tres-grande .game-head p {
    font-size: 8pt !important;
    margin: 1mm 0 0 !important;
  }
  body.print-tres-grande .mots-liste {
    grid-template-columns: repeat(6, 1fr) !important;
    padding: 1.5mm !important;
    gap: 1mm !important;
  }
  body.print-tres-grande .mots-liste li {
    font-size: 8pt !important;
    padding: 1mm !important;
  }
}  /* ⚠️ Fermeture du @media print — INDISPENSABLE */

/* ------------------------------------------------------------
 * 18. ACCESSIBILITÉ — MOUVEMENT RÉDUIT
 * ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
/* ------------------------------------------------------------
 * 19. MODAL
 * ---------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
}
.modal-body {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
/* ------------------------------------------------------------
 * 20. RECHERCHE — filtres + autocomplete
 * ---------------------------------------------------------- */
.search-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  margin-top: 1rem;
  text-align: left;
}
@media (min-width: 640px) {
  .search-filters {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .search-filters {
    grid-template-columns: repeat(4, 1fr);
  }
}
.search-filters .field {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.search-filters label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Autocomplete */
.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 150;
  margin: 0;
  padding: .35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  list-style: none;
}
.ac-list li {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text);
}
.ac-list li:hover,
.ac-list li.is-active {
  background: var(--bg-muted);
}
.ac-list li .ac-ico {
  font-size: 1em;
  opacity: .75;
  flex-shrink: 0;
}
/* ------------------------------------------------------------
 * 21. CARTES AVEC BANDEAU COLORÉ (nouvelle version)
 * ---------------------------------------------------------- */
.card-grid-item {
  padding: 0 !important;
  overflow: hidden;
  flex-direction: row !important;
  gap: 0 !important;
}

.card-stripe {
  flex: 0 0 6px;
  width: 6px;
  align-self: stretch;
}

.card-inner {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.125rem;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.card-ico {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-size-badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Sur mobile on garde la même structure */
@media (max-width: 639.98px) {
  .card-stripe { flex-basis: 4px; width: 4px; }
  .card-inner { padding: 1rem; }
}
/* ------------------------------------------------------------
 * 22. HERO HOME v2 — fond décoratif + badges + compteur
 * ---------------------------------------------------------- */
.hero-home {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 8vw, 5rem);
}
.hero-deco {
  position: absolute;
  inset: 0;
  z-index: 0;
  color: var(--brand);
  pointer-events: none;
}
.hero-deco svg { width: 100%; height: 100%; }
.hero-home .hero-inner {
  position: relative;
  z-index: 1;
}
.hero-inner-wide { max-width: 880px; }

.hero-eyebrow {
  display: inline-block;
  padding: .35rem .9rem;
  margin-bottom: 1rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  border-radius: var(--radius-full);
}
[data-theme="dark"] .hero-eyebrow {
  background: color-mix(in srgb, var(--brand) 20%, transparent);
}

.hero-sub {
  font-size: var(--fs-lg) !important;
  color: var(--text-soft) !important;
}
.hero-sub strong {
  color: var(--text);
  font-weight: 700;
}

.hero-themes {
  margin-top: 1rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem 1.25rem;
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--text-soft);
}
.hero-badges li {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.hero-badges li span {
  color: var(--success);
  font-weight: 800;
}

/* Compteur animé : tabular nums pour éviter les sauts */
[data-counter] {
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 3ch;
}

@media (max-width: 639.98px) {
  .hero-badges { font-size: var(--fs-xs); gap: .35rem .75rem; }
  .hero-home { padding-block: 2.5rem; }
}
/* ------------------------------------------------------------
 * 23. BARRE DE PROGRESSION DE PARTIE
 * ---------------------------------------------------------- */
.game-progress {
  width: 100%;
  height: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .06);
}
.game-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: var(--radius-full);
  transition: width var(--t-slow), background var(--t);
}
.game-progress.is-complete .game-progress-bar {
  background: linear-gradient(90deg, var(--success), #22c55e);
}

/* ------------------------------------------------------------
 * 24. SIDEBAR STICKY (page de jeu, desktop uniquement)
 * ---------------------------------------------------------- */
@media (min-width: 900px) {

  .game-wrap {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }

  /* La colonne des mots (aside) reste visible en scrollant,
     mais sa hauteur est plafonnée pour ne pas suivre la grille. */
  .game-wrap > aside {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding-right: 4px;
    /* Plus de max-height ni overflow : on laisse la sidebar grandir
       naturellement avec ses 3 blocs (mots, word-links, record) */
  }

  /* Le titre reste en haut, non scrollable */
  .game-wrap > aside h2 {
    flex: 0 0 auto;
    padding: .25rem 0 .75rem;
    margin: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }

  /* La liste des mots a son propre plafond et devient scrollable en interne */
  .game-wrap > aside .mots-liste {
    flex: 0 0 auto;                  /* Ne prend plus tout l'espace disponible */
    max-height: 360px;                /* Plafond propre pour la liste seule */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    padding: 1rem;
  }

  /* Scrollbar WebKit fine et discrète */
  .game-wrap > aside .mots-liste::-webkit-scrollbar { width: 6px; }
  .game-wrap > aside .mots-liste::-webkit-scrollbar-track { background: transparent; }
  .game-wrap > aside .mots-liste::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
  }

  /* Le petit texte "Astuce" reste collé en bas, jamais scrollé */
  .game-wrap > aside > p {
    flex: 0 0 auto;
    margin: 0;
  }
}

/* ------------------------------------------------------------
 * 25. TYPOGRAPHIE ÉDITORIALE (.prose)
 *     Pour les blocs de contenu long : guide, aide, SEO.
 * ---------------------------------------------------------- */
.prose {
  max-width: 72ch;
  margin-inline: auto;
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--text-soft);
}
.prose > * + * { margin-top: 1.1rem; }

.prose h2 {
  position: relative;
  font-size: var(--fs-2xl);
  color: var(--text);
  margin-top: 2.75rem;
  margin-bottom: .75rem;
  padding-left: 1rem;
  line-height: 1.25;
}
.prose h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: .35em;
  bottom: .35em;
  width: 4px;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, var(--brand), var(--accent));
}

.prose h3 {
  font-size: var(--fs-xl);
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: .5rem;
  letter-spacing: -.005em;
}

.prose h4 {
  font-size: var(--fs-lg);
  color: var(--text);
  margin-top: 1.5rem;
  margin-bottom: .35rem;
}

.prose p {
  margin-bottom: 0;
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose em {
  color: var(--text);
  font-style: italic;
}

.prose a:not(.btn) {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--t-fast);
}
.prose a:not(.btn):hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}
.prose ul { list-style: none; }
.prose ul > li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: .5rem;
}
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}
.prose ol > li {
  margin-bottom: .5rem;
  padding-left: .35rem;
}
.prose ol > li::marker {
  color: var(--brand);
  font-weight: 700;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text);
}
.prose blockquote p { margin: 0; }

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose code {
  padding: .15em .4em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.prose kbd {
  padding: .15em .5em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85em;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  color: var(--text);
  white-space: nowrap;
}

/* ------------------------------------------------------------
 * 26. CALLOUTS — encadrés info / tip / warn / danger
 * ---------------------------------------------------------- */
.callout {
  display: flex;
  gap: .875rem;
  padding: 1rem 1.125rem;
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text);
}
.callout > .callout-icon {
  flex: 0 0 auto;
  font-size: 1.25rem;
  line-height: 1;
}
.callout > .callout-body { min-width: 0; }
.callout strong { display: block; margin-bottom: .25rem; font-weight: 700; }
.callout p:last-child { margin-bottom: 0; }

.callout--info {
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.callout--tip {
  background: color-mix(in srgb, var(--success) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
}
.callout--warn {
  background: color-mix(in srgb, var(--warning) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
}
.callout--danger {
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}

[data-theme="dark"] .callout--info   { background: color-mix(in srgb, var(--brand) 15%, var(--surface)); }
[data-theme="dark"] .callout--tip    { background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
[data-theme="dark"] .callout--warn   { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
[data-theme="dark"] .callout--danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }

/* ------------------------------------------------------------
 * 27. ÉTAPES NUMÉROTÉES (.step-list)
 *     Sélecteurs volontairement plus spécifiques que .prose ol
 *     pour éviter tout conflit de cascade.
 * ---------------------------------------------------------- */
.prose ol.step-list,
ol.step-list {
  display: grid;
  gap: 1rem;
  counter-reset: step;
  padding: 0;
  margin: 1.5rem 0;
  list-style: none;
}

/* Masque le marker par défaut (puce/numéro) si un navigateur
   réintroduit un `list-style` via une autre règle */
.prose ol.step-list > li::marker,
ol.step-list > li::marker {
  content: none;
}

.prose ol.step-list > li,
ol.step-list > li {
  position: relative;
  padding: 1rem 1.25rem 1rem 3.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  counter-increment: step;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-soft);
  margin-bottom: 0;
}

.prose ol.step-list > li::before,
ol.step-list > li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  font-weight: 800;
  font-size: .875rem;
  line-height: 1;
}

.prose ol.step-list > li strong,
ol.step-list > li strong {
  display: block;
  color: var(--text);
  font-weight: 700;
  margin-bottom: .25rem;
  font-size: var(--fs-base);
}

/* ------------------------------------------------------------
 * 28. FAQ v2 — cartes visuelles avec catégories
 * ---------------------------------------------------------- */
.faq-category {
  margin-top: 2.5rem;
}
.faq-category:first-child { margin-top: 0; }

.faq-category-title {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.faq-category-title .faq-cat-ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  flex-shrink: 0;
}
.faq-category-title .faq-cat-count {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.faq {
  display: grid;
  gap: .5rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.faq-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.faq-item[open] {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow);
}

.faq-item summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
}
.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform var(--t);
}
.faq-item[open] summary::after {
  transform: rotate(180deg);
}

.faq-item summary > .faq-q-ico {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand);
  font-size: .75rem;
  font-weight: 800;
  flex-shrink: 0;
}

.faq-answer {
  padding: 0 1.25rem 1.125rem 1.25rem;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.7;
}
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ------------------------------------------------------------
 * 29. SOMMAIRE STICKY (guide, aide)
 * ---------------------------------------------------------- */
.toc {
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.toc-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .5rem;
  display: block;
}
.toc ol,
.toc ul {
  padding-left: 1.1rem;
  margin: 0;
  line-height: 1.9;
  font-size: var(--fs-sm);
}
.toc a {
  color: var(--text-soft);
  transition: color var(--t-fast);
}
.toc a:hover { color: var(--link); }

@media (min-width: 1024px) {
  .toc-sticky {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
}

/* ------------------------------------------------------------
 * 30. LAYOUT ARTICLE 2 COLONNES (sommaire + contenu)
 * ---------------------------------------------------------- */
.article-layout {
  display: grid;
  gap: 2rem;
  max-width: 1100px;
  margin-inline: auto;
}
@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: 240px 1fr;
  }
}

/* ------------------------------------------------------------
 * 31. BLOCS DE MISE EN AVANT
 * ---------------------------------------------------------- */
.feature-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 2rem 0;
}
@media (min-width: 640px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(4, 1fr); }
}

.feature {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.feature:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.feature-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  margin-bottom: .25rem;
}
.feature h4 {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.feature p {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin: 0;
  line-height: 1.55;
}

/* ------------------------------------------------------------
 * 32. STATS HERO (chiffres clés)
 * ---------------------------------------------------------- */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.stat-strip > div {
  text-align: center;
}
.stat-strip .stat-num {
  display: block;
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-strip .stat-label {
  display: block;
  margin-top: .35rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
/* ------------------------------------------------------------
 * 33. SUGGESTIONS DE THÈMES (dans .prose)
 * ---------------------------------------------------------- */
.theme-suggestions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .theme-suggestions {
    grid-template-columns: repeat(2, 1fr);
  }
}

.theme-suggestion {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none !important;
  color: var(--text) !important;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.theme-suggestion:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--shadow);
}
.theme-suggestion-ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
  background: var(--bg-muted);
  border-radius: var(--radius);
}
.theme-suggestion-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.theme-suggestion-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.theme-suggestion-name {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-suggestion-arrow {
  margin-left: auto;
  font-size: 1.125rem;
  color: var(--text-muted);
  transition: transform var(--t), color var(--t);
  flex-shrink: 0;
}
.theme-suggestion:hover .theme-suggestion-arrow {
  color: var(--brand);
  transform: translateX(3px);
}

/* Variante "voir tous les thèmes" (accent discret) */
.theme-suggestion--all {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.theme-suggestion--all .theme-suggestion-ico {
  background: color-mix(in srgb, var(--brand) 15%, transparent);
}

/* Empêche le .prose de casser les chips */
.prose .theme-suggestions { padding-left: 0; }
.prose .theme-suggestions > a { text-decoration: none !important; }

/* ------------------------------------------------------------
 * 34. CHIPS DE THÈMES — amélioration affichage
 * ---------------------------------------------------------- */
.grid-themes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--gap-sm);
}
.theme-chip {
  min-width: 0;
}
.theme-chip > span:not(.theme-chip-ico) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
/* ------------------------------------------------------------
 * 35. REDIRECTION /taille/[N] vers /mots-meles?taille=N
 *     Nginx gère la réécriture, pas besoin de CSS.
 *     Cette règle garde le body identifiable si besoin.
 * ---------------------------------------------------------- */
body.taille-page .hero { padding-block: 3rem 2.5rem; }
/* ------------------------------------------------------------
 * 36 bis. BLOG
 * ---------------------------------------------------------- */
.blog-list {
  display: grid;
  gap: 1.75rem;
}

.blog-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.blog-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: var(--shadow-lg);
}

.blog-card-link {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  color: inherit;
  text-decoration: none;
}
@media (min-width: 640px) {
  .blog-card-link {
    grid-template-columns: 200px 1fr;
    align-items: stretch;
  }
}

/* --- Bloc coloré à gauche --- */
.blog-card-cover {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 140px;
  font-size: 3.5rem;
  line-height: 1;
  overflow: hidden;
}
@media (min-width: 640px) {
  .blog-card-cover {
    min-height: 100%;
    font-size: 4rem;
  }
}
/* Motif discret en fond pour éviter l'aplat */
.blog-card-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.35) 0, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0,0,0,.08) 0, transparent 40%);
  pointer-events: none;
}
.blog-card-cover > span {
  position: relative;
  z-index: 1;
}

/* --- Corps de la carte --- */
.blog-card-body {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 1.35rem 1.5rem;
}

.blog-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .55rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.blog-card-cat {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-radius: var(--radius-full);
  background: currentColor;
}
.blog-card-cat > span:first-child {
  /* Reset de la couleur du texte pour qu'il soit contrasté sur le fond */
  color: var(--surface);
  mix-blend-mode: normal;
}
/* Solution propre : on utilise une couleur de fond et du texte foncé */
.blog-card-cat {
  background: color-mix(in srgb, currentColor 15%, transparent);
  color: inherit;
}

.blog-card-title {
  font-size: clamp(1.15rem, 1rem + .5vw, 1.4rem);
  font-weight: 700;
  line-height: 1.28;
  margin: 0;
  color: var(--text);
  letter-spacing: -.01em;
}

.blog-card-excerpt {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-more {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: auto;
  padding-top: .5rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand);
  transition: gap var(--t);
}
.blog-card:hover .blog-card-more { gap: .65rem; }

/* ============================================================
 * PAGE ARTICLE
 * ============================================================ */
.blog-article-cat {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, currentColor 15%, transparent);
  margin-bottom: 1rem;
}

.blog-article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .6rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: .75rem 0 0;
}

/* Titre de l'article plus grand */
.blog-article-hero h1,
.hero .blog-article-cat + h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -.02em;
}/* ------------------------------------------------------------
 * 36. SECTION « À PROPOS » DE LA PAGE GRILLE
 * ---------------------------------------------------------- */
.grille-about {
  padding-block: clamp(2.5rem, 5vw, 4rem);
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
}

.grille-about-inner {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 900px) {
  .grille-about-inner {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 2.5rem;
  }
}

/* --- Colonne principale --- */
.grille-about-main h2 {
  font-size: var(--fs-2xl);
  color: var(--text);
  margin: 0 0 1.25rem;
  letter-spacing: -.015em;
  line-height: 1.2;
}

.grille-about-main p {
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--text-soft);
  margin: 0 0 1rem;
}
.grille-about-main p:last-child { margin-bottom: 0; }

.grille-about-main strong {
  color: var(--text);
  font-weight: 700;
}

.grille-about-main a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--t-fast);
}
.grille-about-main a:hover { color: var(--link-hover); }

/* --- Colonne astuces (carte blanche) --- */
.grille-about-tips {
  padding: 1.5rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 900px) {
  .grille-about-tips {
    position: sticky;
    top: 84px;
  }
}

.grille-about-tips h3 {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.grille-about-tips .tips-ico {
  font-size: 1.15rem;
  line-height: 1;
}

.grille-about-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .75rem;
}
.grille-about-tips li {
  position: relative;
  padding-left: 1.5rem;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text-soft);
}
.grille-about-tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .5em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.grille-about-tips a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

/* --- Liens de navigation contextuels --- */
.grille-about-nav {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 640px) {
  .grille-about-nav {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grille-about-nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.grille-about-nav-link:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.nav-link-ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  font-size: 1.35rem;
  background: var(--bg-muted);
  border-radius: var(--radius);
}

.nav-link-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.nav-link-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.nav-link-title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link-arrow {
  margin-left: auto;
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform var(--t), color var(--t);
  flex-shrink: 0;
}
.grille-about-nav-link:hover .nav-link-arrow {
  color: var(--brand);
  transform: translateX(4px);
}

/* Ajustement : la section ne doit pas être imprimée */
@media print {
  .grille-about { display: none !important; }
}
/* ------------------------------------------------------------
 * 37. BANDEAU INFO PAGE « MES GRILLES »
 *     Version plus large et plus compacte du callout warn
 * ---------------------------------------------------------- */
.callout--warn {
  /* Réduit le padding vertical, garde un padding horizontal généreux */
  padding: .875rem 1.25rem;
}

/* Sur grand écran, deux colonnes : icône fixe à gauche, texte à droite */
.callout--warn > .callout-icon {
  margin-top: .1rem;
}

/* Le paragraphe à l'intérieur est plus aéré */
.callout--warn .callout-body p {
  margin: .35rem 0 0;
  line-height: 1.6;
  max-width: none;
}

/* Sur tablette et desktop, s'il y a beaucoup de texte, on peut
   passer en 2 colonnes horizontales via flex-wrap */
@media (min-width: 768px) {
  .callout--warn {
    padding: 1rem 1.5rem;
  }
}
/* ------------------------------------------------------------
 * 39. FIX — Boutons dans le sommaire et l'article
 *     Empêche les règles de liens (.prose, .toc) de casser
 *     l'apparence des boutons au survol.
 * ---------------------------------------------------------- */
.toc .btn,
.article-layout .btn,
.blog-card .btn {
  text-decoration: none !important;
}

.toc .btn-primary,
.article-layout .btn-primary,
.blog-card .btn-primary {
  background: var(--brand);
  color: #fff !important;
}
.toc .btn-primary:hover,
.article-layout .btn-primary:hover,
.blog-card .btn-primary:hover {
  background: var(--brand-dark);
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: var(--shadow);
}

.toc .btn-secondary,
.article-layout .btn-secondary {
  background: var(--surface-2);
  color: var(--text) !important;
  border-color: var(--border);
}
.toc .btn-secondary:hover,
.article-layout .btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
  color: var(--text) !important;
}

.toc .btn-ghost,
.article-layout .btn-ghost {
  color: var(--text-soft) !important;
}
.toc .btn-ghost:hover,
.article-layout .btn-ghost:hover {
  background: var(--bg-muted);
  color: var(--text) !important;
}

/* Neutralise toute règle générique de soulignement sur les liens-boutons */
a.btn,
a.btn:hover,
a.btn:focus {
  text-decoration: none !important;
}
/* ------------------------------------------------------------
 * 40. HEADER — anti-wrap menu principal
 * ---------------------------------------------------------- */
.primary-nav a,
.primary-nav .dropdown-toggle {
  white-space: nowrap;
}

@media (min-width: 900px) {
  .primary-nav ul {
    flex-wrap: nowrap;
  }
}

/* Sur écran intermédiaire (640-900), compacter légèrement */
@media (max-width: 900px) and (min-width: 640px) {
  .primary-nav a,
  .primary-nav .dropdown-toggle {
    padding: .5rem .55rem;
    font-size: var(--fs-xs);
  }
  .header-search input { width: 80px; }
  .header-search input:focus { width: 140px; }
}
/* ------------------------------------------------------------
 * 41. PAGE STATISTIQUES — KPI, barres, listes, activité
 * ---------------------------------------------------------- */
.stats-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stats-kpi {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1.25rem 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.stats-kpi:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.stats-kpi-ico {
  font-size: 1.5rem;
  line-height: 1;
}

.stats-kpi-value {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stats-kpi-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

/* --- Layout 2 colonnes --- */
.stats-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Cartes --- */
.stats-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stats-card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

/* --- Barres de progression par niveau --- */
.stats-bars {
  display: grid;
  gap: 1rem;
}

.stats-bar-row {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.stats-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.stats-bar-count {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.stats-bar-track {
  height: 10px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--t-slow);
}
.stats-bar-fill.badge--facile    { background: #16a34a; }
.stats-bar-fill.badge--moyen     { background: #ca8a04; }
.stats-bar-fill.badge--difficile { background: #ea580c; }
.stats-bar-fill.badge--expert    { background: #dc2626; }

/* --- Listes (thèmes, temps) --- */
.stats-list {
  display: grid;
  gap: .5rem;
}

.stats-list-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}

.stats-list-ico {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.stats-list-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
}

.stats-list-value {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* --- Activité --- */
.stats-activity {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .stats-activity {
    grid-template-columns: 1fr 1fr;
  }
}

.stats-activity-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
}

.stats-activity-card[style*="grid-column"] {
  flex-direction: row;
  text-align: left;
  gap: 1rem;
  align-items: center;
}

.stats-activity-ico {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: .5rem;
  flex-shrink: 0;
}

.stats-activity-num {
  font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stats-activity-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: .35rem;
}
/* ------------------------------------------------------------
 * 38. DÉFI DU JOUR
 * ---------------------------------------------------------- */
.defi-card {
  position: relative;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), border-color var(--t);
}
.defi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.defi-card--home {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--warning) 6%, var(--surface)) 0%,
    var(--surface) 60%);
}

.defi-card-stripe {
  flex: 0 0 6px;
  width: 6px;
  align-self: stretch;
}

.defi-card-inner {
  flex: 1 1 auto;
  padding: 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  min-width: 0;
}
@media (max-width: 639.98px) {
  .defi-card-inner { padding: 1.25rem; }
}

.defi-card-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.defi-card-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

.defi-card-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.defi-card-ico {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.defi-card-theme {
  margin-left: .35rem;
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

.defi-card-title {
  font-size: clamp(1.35rem, 1.15rem + 1vw, 1.75rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0;
}

.defi-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
  margin-top: .5rem;
}
.defi-card-stat {
  display: flex;
  flex-direction: column;
}
.defi-card-stat-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
}
.defi-card-stat-value {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.defi-card-cta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* --- Bandeau streak --- */
.defi-streak {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--warning) 18%, var(--surface)) 0%,
    color-mix(in srgb, var(--warning) 8%, var(--surface)) 100%);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--border));
  border-radius: var(--radius-lg);
}
.defi-streak-ico {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.defi-streak-text strong {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--text);
  margin-bottom: .15rem;
}
.defi-streak-text p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

@media (prefers-reduced-motion: reduce) {
  .defi-card { transition: none; }
}
/* ------------------------------------------------------------
 * 42. OPTIMISATIONS CORE WEB VITALS
 * ---------------------------------------------------------- */

/* Font-display swap : évite le FOIT */
* {
  font-display: swap;
}

/* Réserve l'espace pour éviter tout décalage */
.card-cover {
  min-height: 120px;
}

.defi-card-ico {
  min-width: 2rem;
  min-height: 2rem;
}

/* ------------------------------------------------------------
 * 43. MODE LOUPE (grandes grilles)
 * ---------------------------------------------------------- */
.loupe {
  position: fixed;
  z-index: 500;
  pointer-events: none;
  padding: 6px;
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: loupe-in 150ms ease;
}

@keyframes loupe-in {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

.loupe-inner {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  grid-template-rows: repeat(5, 40px);
  gap: 2px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.loupe-case {
  display: grid;
  place-items: center;
  background: var(--case-bg);
  border: 1px solid var(--case-border);
  border-radius: 4px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--case-text);
  font-family: inherit;
}

.loupe-case.is-found {
  background: var(--case-found);
  color: var(--case-found-text);
}

.loupe-case.is-selected {
  background: var(--case-selected);
}

.loupe-case.is-current {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  z-index: 1;
}

.loupe-case.is-empty {
  background: transparent;
  border-color: transparent;
}

/* Bouton de bascule — inline dans la barre d'actions */
.loupe-toggle-btn {
  /* Réutilise .btn / .btn-secondary (ou .btn-primary quand actif) */
}

.loupe-toggle-btn[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.loupe-toggle-btn[aria-pressed="true"]:hover {
  background: var(--brand-dark);
}

/* Sur mobile : loupe compacte */
@media (max-width: 639.98px) {
  .loupe-inner {
    grid-template-columns: repeat(5, 34px);
    grid-template-rows: repeat(5, 34px);
  }
  .loupe-case { font-size: .9rem; }
}

/* Impression : masquer */
@media print {
  .loupe,
  .loupe-toggle-btn { display: none !important; }
}

/* ------------------------------------------------------------
 * 44. FIX CLS — stabilité visuelle
 * ---------------------------------------------------------- */

/* Hero : hauteur fixe, plus aucun saut possible */
.hero-home {
  min-height: 480px;
  contain: layout style;
}

@media (max-width: 639.98px) {
  .hero-home { min-height: 400px; }
}

@media (min-width: 1024px) {
  .hero-home { min-height: 520px; }
}

/* Les sections principales : layout isolé */
.section {
  contain: layout style;
}

/* Le main : évite un décalage global au chargement */
main {
  min-height: 60vh;
}

/* Empêche le shift des titres pendant le rendu initial */
h1, h2, h3, h4,
.card-title,
.defi-card-title,
.blog-card-title {
  text-rendering: optimizeSpeed;
}

/* Les liens du footer : hauteur stable */
.footer-col a {
  min-height: 32px;
}
/* ------------------------------------------------------------
 * 45. CARTE D'AIDE LOUPE (grandes grilles)
 * ---------------------------------------------------------- */
.loupe-hint {
  position: relative;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.125rem 1.25rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--warning) 10%, var(--surface)) 0%,
    color-mix(in srgb, var(--brand) 5%, var(--surface)) 100%);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: loupe-hint-in 320ms ease;
}

@keyframes loupe-hint-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.loupe-hint.is-activated {
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
}

.loupe-hint-icon {
  flex-shrink: 0;
  font-size: 1.75rem;
  line-height: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: color-mix(in srgb, var(--warning) 20%, var(--surface));
  border-radius: var(--radius);
}

.loupe-hint.is-activated .loupe-hint-icon {
  background: color-mix(in srgb, var(--success) 20%, var(--surface));
}

.loupe-hint-body {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.loupe-hint-body strong {
  display: block;
  font-size: var(--fs-base);
  font-weight: 700;
  margin-bottom: .35rem;
  color: var(--text);
}

.loupe-hint-body p {
  margin: 0 0 .75rem;
  color: var(--text-soft);
}

.loupe-hint-body em {
  font-style: normal;
  font-weight: 700;
  color: var(--brand);
}

.loupe-hint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
}

.loupe-hint-actions .btn {
  min-height: 38px;
  padding: .5rem .875rem;
  font-size: var(--fs-xs);
}

.loupe-hint-close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: .875rem;
  transition: background var(--t-fast), color var(--t-fast);
}
.loupe-hint-close:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

/* Sur mobile : padding plus compact */
@media (max-width: 639.98px) {
  .loupe-hint {
    padding: 1rem;
    gap: .75rem;
  }
  .loupe-hint-icon {
    width: 38px;
    height: 38px;
    font-size: 1.4rem;
  }
  .loupe-hint-actions {
    flex-direction: column;
  }
  .loupe-hint-actions .btn {
    width: 100%;
  }
}

/* Impression : masquer */
@media print {
  .loupe-hint { display: none !important; }
}
/* ------------------------------------------------------------
 * 46. CARTES v2 — sous-titre + stat
 * ---------------------------------------------------------- */
.card-subtitle {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  line-height: 1.35;
}
.card-subtitle .card-dot {
  opacity: .5;
}
.card-subtitle > span:not(.card-dot) {
  white-space: nowrap;
}

.card-stat {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.card-stat--muted {
  border-top-color: transparent;
  color: var(--text-muted);
  font-weight: 500;
}

.card-title {
  margin: 0;
}

/* Sous-titre de la carte de reprise (défi home) */
.defi-card-subtitle {
  margin: 0 0 .5rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
 * 47. HERO — chips thèmes populaires
 * ---------------------------------------------------------- */
.hero-themes-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  margin-top: 1.5rem;
}
.hero-themes-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.hero-themes-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
}
.hero-theme-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), border-color var(--t-fast),
              background var(--t-fast), box-shadow var(--t-fast);
}
.hero-theme-chip:hover,
.hero-theme-chip:focus-visible {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.hero-theme-chip-ico {
  font-size: 1.05em;
  line-height: 1;
}
@media (max-width: 639.98px) {
  .hero-theme-chip {
    padding: .4rem .75rem;
    font-size: var(--fs-xs);
  }
}

/* ------------------------------------------------------------
 * 48. MENU DE PARTAGE SOCIAL (page de jeu)
 * ---------------------------------------------------------- */
.share-wrap {
  position: relative;
  display: inline-block;
}

.share-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 220px;
  padding: .4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: share-menu-in 140ms ease;
}
.share-menu[hidden] { display: none; }

@keyframes share-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.share-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  font-size: var(--fs-sm);
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  width: 100%;
}
.share-item:hover,
.share-item:focus-visible {
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
}
.share-item[hidden] { display: none; }

.share-ico {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.share-sep {
  margin: .25rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Mobile : le menu s'aligne en bas */
@media (max-width: 639.98px) {
  .share-menu {
    right: auto;
    left: 0;
  }
}

/* ------------------------------------------------------------
 * 49. RECORD DE GRILLE (page de jeu)
 * ---------------------------------------------------------- */
.record-badge {
  margin-top: 1rem;
  padding: 1rem 1.125rem;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--warning) 8%, var(--surface)) 0%,
    var(--surface) 100%);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.record-badge--empty {
  background: var(--surface);
  border-color: var(--border);
  opacity: .85;
}
.record-badge-head {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .35rem;
}
.record-badge-ico { font-size: 1.15rem; line-height: 1; }
.record-badge-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.record-badge-time {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.85rem);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -.02em;
}
.record-badge-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin-top: .35rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.record-badge-empty-text {
  margin: .35rem 0 0;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: 1.5;
}

/* Impression : masquer */
@media print {
  .record-badge { display: none !important; }
}

/* Bloc record dans la modale de fin */
.modal-record {
  margin-top: 1rem;
  padding: .75rem .875rem;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  color: var(--text);
}
.modal-record-line {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.modal-record-ico {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}
.modal-record-text { line-height: 1.4; }
.modal-record-text strong { color: var(--text); font-weight: 700; }

/* Description + aide contextuelle dans le bloc record */
.record-badge-desc {
  margin: .35rem 0 .25rem;
  font-size: var(--fs-xs);
  color: var(--text-soft);
  line-height: 1.5;
}
.record-badge-desc strong {
  color: var(--text);
  font-weight: 700;
}
.record-badge-help {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid color-mix(in srgb, var(--warning) 25%, var(--border));
  font-size: var(--fs-xs);
}
.record-badge-help summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  padding: .15rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.record-badge-help summary::-webkit-details-marker { display: none; }
.record-badge-help summary::before {
  content: "?";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  font-size: .7rem;
  font-weight: 800;
  border-radius: 50%;
  background: color-mix(in srgb, var(--warning) 25%, transparent);
  color: var(--text);
  flex-shrink: 0;
}
.record-badge-help[open] summary {
  margin-bottom: .5rem;
}
.record-badge-help p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}
.record-badge-help p strong {
  color: var(--text);
  font-weight: 700;
}

/* ------------------------------------------------------------
 * 51. STATS DE GRILLE (section À propos)
 * ---------------------------------------------------------- */
.grille-stats-bloc {
  margin-top: 1.75rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand) 5%, var(--surface)) 0%,
    var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.grille-stats-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.grille-stats-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 0;
}
.grille-stat {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.grille-stat dt {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.grille-stat dd {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.grille-stat--highlight dd {
  color: var(--success);
}

/* ------------------------------------------------------------
 * 52. STATS DE THÈME (page /theme/<slug>)
 * ---------------------------------------------------------- */
.theme-stats-bloc {
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand) 5%, var(--surface)) 0%,
    var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.theme-stats-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.theme-stats-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin: 0;
}
.theme-stat {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.theme-stat dt {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.theme-stat dd {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.theme-stat--highlight dd {
  color: var(--success);
}
.theme-stats-top {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-soft);
}
.theme-stats-top a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.theme-stats-top a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* ------------------------------------------------------------
 * 53. MAILLAGE PAR MOTS (page de jeu)
 * ---------------------------------------------------------- */
.word-links {
  margin-top: 1rem;
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.word-links-title {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.word-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .35rem;
}
.word-link a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .55rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.word-link a:hover {
  background: var(--bg-muted);
  text-decoration: none;
}
.word-link-word {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.word-link-count {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.word-link-arrow {
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: transform var(--t-fast), color var(--t-fast);
}
.word-link a:hover .word-link-arrow {
  color: var(--brand);
  transform: translateX(3px);
}

/* Impression : masquer */
@media print {
  .word-links { display: none !important; }
}

/* ------------------------------------------------------------
 * 54. SECTION MAILLAGE — fond différencié
 * ---------------------------------------------------------- */
.section-maillage {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand) 6%, var(--bg-soft)) 0%,
    var(--bg-soft) 100%);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--brand) 15%, var(--border));
  margin-top: 2.5rem;
  box-shadow: var(--shadow-sm);
}
.section-maillage > h2,
.section-maillage .section-head h2 {
  padding-bottom: .5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border));
  margin-bottom: 1.25rem;
}
.section-maillage .section-head {
  margin-bottom: 1.25rem;
}

/* Un peu plus marqué en mode sombre */
[data-theme="dark"] .section-maillage {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand) 8%, var(--bg-soft)) 0%,
    var(--bg-soft) 100%);
  border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
}

/* Responsive : padding réduit sur mobile */
@media (max-width: 639.98px) {
  .section-maillage {
    padding: 1.25rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: var(--radius);
  }
}

/* Impression : pas de fond, pas de bordure */
@media print {
  .section-maillage {
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
}


/* ------------------------------------------------------------
 * 55. BARRE DE NAVIGATION DE GRILLE (mobile, grandes grilles)
 * ---------------------------------------------------------- */
.board-nav {
  display: none;   /* caché en desktop, activé en mobile */
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
  padding: .5rem .75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.board-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0 .75rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.board-nav-btn:hover,
.board-nav-btn:focus-visible {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}
.board-nav-btn:active {
  transform: scale(.96);
}
.board-nav-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.board-nav-info {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 899.98px) {
  .board-nav.is-needed {
    display: flex;
  }
}
@media (min-width: 900px) {
  .board-nav {
    display: none !important;
  }
}
@media print {
  .board-nav {
    display: none !important;
  }
}

/* ------------------------------------------------------------
 * 56. MOBILE — Réordonner la sidebar (mots à trouver plus haut)
 * ---------------------------------------------------------- */
@media (max-width: 899.98px) {
  /* On passe game-wrap en flex column.
     align-items: stretch est OBLIGATOIRE pour que tous les
     enfants prennent toute la largeur disponible. */
  .game-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap-lg);
  }

  /* On "dissout" la div principale : ses enfants remontent
     au niveau du game-wrap et deviennent items flex directs.
     Ça permet de les réordonner avec 'order'. */
  .game-wrap > div:first-child {
    display: contents;
  }

  /* Et on "dissout" aussi l'aside pour pouvoir séparer
     les mots à trouver du bloc record. */
  .game-wrap > aside {
    display: contents;
  }

  /* Ordre final sur mobile :
     1. board-nav (navigation horizontale)
     2. grille de jeu
     3. progression
     4. stats (temps/indices)
     5. boutons d'action
     6. TITRE + LISTE DES MOTS (remontés ici)
     7. word-links
     8. record
  */
  .game-wrap .board-nav           { order: 1; }
  .game-wrap .game-board-scroll   { order: 2; }
  .game-wrap .game-progress       { order: 3; }
  .game-wrap .game-stats          { order: 4; }
  .game-wrap .game-actions        { order: 5; }
  .game-wrap > aside > h2         { order: 6; }
  .game-wrap > aside > .mots-liste { order: 7; }
  .game-wrap .word-links          { order: 8; }
  .game-wrap > aside > .record-badge { order: 9; }

  /* Styles adaptés : la liste des mots prend toute la largeur
     et s'affiche en GRILLE (pas en flex column) */
  .game-wrap > aside > h2 {
    padding: 0;
    margin: 0;
    border-bottom: 0;
    background: none;
    font-size: var(--fs-lg);
  }

  /* Grille FORCÉE à 3 colonnes fixes (fiable même avec display:contents) */
  .mots-liste,
  .game-wrap .mots-liste,
  .game-wrap > aside > .mots-liste {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: .4rem !important;
    max-height: none !important;
    padding: .875rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .mots-liste li,
  .game-wrap .mots-liste li {
    padding: .4rem .35rem !important;
    font-size: .72rem !important;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Le record prend un peu moins de place en mobile */
  .game-wrap > aside > .record-badge {
    margin-top: 0;
  }

  /* Sécurité : tous les blocs directs du game-wrap prennent
     toute la largeur (flex column + stretch ne suffit pas toujours) */
  .game-wrap > .board-nav,
  .game-wrap > .game-board-scroll,
  .game-wrap > .game-progress,
  .game-wrap > .game-stats,
  .game-wrap > .game-actions,
  .game-wrap > .word-links,
  .game-wrap > aside > h2,
  .game-wrap > aside > .mots-liste,
  .game-wrap > aside > .record-badge {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* ------------------------------------------------------------
 * 57. FOOTER — Compactage sur mobile
 * ---------------------------------------------------------- */
@media (max-width: 639.98px) {
  /* Le footer passe en 2 colonnes au lieu d'1 seule */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-lg);
  }

  /* La marque prend toute la largeur (elle contient du texte long) */
  .footer-brand {
    grid-column: 1 / -1;
  }

  /* Les 3 colonnes de liens se répartissent sur 2 colonnes
     → Jouer | Par taille
     → Informations | (vide) */
  .footer-col:not(.footer-brand) {
    min-width: 0;
  }

  /* Les liens sont plus compacts */
  .footer-col ul {
    gap: .2rem;
  }
  .footer-col a {
    min-height: 28px;
    font-size: var(--fs-xs);
  }

  /* Le titre du footer plus compact */
  .footer-title {
    font-size: .7rem;
    margin-bottom: .35rem;
  }

  /* La bande de thèmes populaires reste sur toute la largeur */
  .footer-themes-strip {
    margin-top: var(--gap);
  }
}

/* ------------------------------------------------------------
 * 58. BANDEAU COOKIES
 * ---------------------------------------------------------- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  padding: 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
  animation: cookieSlideUp 320ms ease;
}
.cookie-banner[hidden] { display: none; }

@keyframes cookieSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.cookie-banner-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cookie-banner-content {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.cookie-banner-ico {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.cookie-banner-text {
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-soft);
}
.cookie-banner-text strong {
  display: block;
  color: var(--text);
  font-weight: 700;
  margin-bottom: .25rem;
}
.cookie-banner-text p {
  margin: 0;
}
.cookie-banner-text a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

@media (min-width: 768px) {
  .cookie-banner-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .cookie-banner-content {
    flex: 1 1 auto;
    max-width: 720px;
  }
  .cookie-banner-actions {
    flex: 0 0 auto;
  }
}

/* Impression : masquer */
@media print {
  .cookie-banner { display: none !important; }
}
