/* ==========================================================================
   Jeux Culture — design system
   Palette « atlas » : encre de Prusse, papier calque, safran, vermillon,
   céladon, lilas. Typo : Bricolage Grotesque (interface) + Newsreader (lecture).
   ========================================================================== */

@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage.woff2") format("woff2-variations"), url("../fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader.woff2") format("woff2-variations"), url("../fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-italic.woff2") format("woff2-variations"), url("../fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800; font-style: italic; font-display: swap;
}

:root {
  --prusse: #12304a;
  --prusse-2: #1c4566;
  --prusse-3: #2b5f86;
  --calque: #e8edef;
  --papier: #f8fafb;
  --blanc: #ffffff;
  --encre: #1b2430;
  --gris: #5d6b78;
  --ligne: #cfd8de;
  --safran: #f2b134;
  --safran-fonce: #b97c0a;
  --vermillon: #d9483b;
  --celadon: #3f9c80;
  --celadon-clair: #d7efe6;
  --lilas: #7b6cd9;
  --cobalt: #2f6fdb;

  --accent: var(--safran);
  --accent-encre: var(--prusse);

  --f-ui: "Bricolage", "Segoe UI", system-ui, sans-serif;
  --f-lecture: "Newsreader", Georgia, "Times New Roman", serif;

  --t-xs: .78rem; --t-s: .9rem; --t-m: 1rem; --t-l: 1.25rem;
  --t-xl: 1.6rem; --t-2xl: 2.1rem; --t-3xl: clamp(2.2rem, 4.6vw, 3.6rem);

  --r-s: 8px; --r-m: 14px; --r-l: 24px;
  --largeur-barre: 288px;
  --ombre-dure: 0 2px 0 rgba(18, 48, 74, .14);
  --ombre-flotte: 0 24px 60px -18px rgba(18, 48, 74, .45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-ui); font-size: var(--t-m); line-height: 1.5; color: var(--encre);
  background-color: var(--calque);
  background-image:
    linear-gradient(rgba(18,48,74,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18,48,74,.045) 1px, transparent 1px);
  background-size: 28px 28px;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
a { color: var(--prusse-2); }
:focus-visible { outline: 3px solid var(--safran); outline-offset: 2px; border-radius: 4px; }
.cachee { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============================ Coque ============================ */
.coque { display: grid; grid-template-columns: var(--largeur-barre) minmax(0, 1fr); min-height: 100vh; }

/* ---------- Carnet latéral ---------- */
.carnet {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--prusse); color: #e9f0f5;
  display: flex; flex-direction: column; gap: 22px; padding: 26px 22px 22px;
  background-image:
    radial-gradient(circle at 50% 120px, rgba(242,177,52,.16), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 22px);
  scrollbar-width: thin;
}
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.marque svg { width: 34px; height: 34px; }
.marque b { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; font-stretch: 85%; }
.marque small { display: block; font-size: var(--t-xs); color: #9fb6c8; font-weight: 500; }

.portrait {
  position: relative; display: grid; justify-items: center; gap: 10px; text-align: center;
  border: 0; background: none; padding: 6px; border-radius: var(--r-l);
}
.portrait:hover .portrait-cadre { transform: rotate(-4deg) scale(1.03); }
.portrait-cadre { position: relative; width: 152px; height: 152px; transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
.portrait-anneau { position: absolute; inset: 0; transform: rotate(-90deg); }
.portrait-anneau circle { fill: none; stroke-width: 7; }
.portrait-anneau .fond { stroke: rgba(255,255,255,.12); }
.portrait-anneau .jauge { stroke: var(--safran); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.portrait-image {
  position: absolute; inset: 14px; border-radius: 50%; overflow: hidden; background: var(--prusse-2);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.1);
}
.portrait-image img, .portrait-image svg { width: 100%; height: 100%; object-fit: cover; }
.portrait-crayon {
  position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--safran); color: var(--prusse); display: grid; place-items: center;
  box-shadow: 0 0 0 4px var(--prusse); font-size: 1rem;
}
.portrait-niveau {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%);
  background: var(--blanc); color: var(--prusse); font-weight: 800; font-size: var(--t-xs);
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.portrait-nom { font-weight: 700; font-size: var(--t-l); line-height: 1.15; color: #fff; }
.portrait-titre { font-family: var(--f-lecture); font-style: italic; color: #b9cad7; font-size: var(--t-s); }

.tresor {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-m); padding: 14px 16px;
}
.piece-or {
  grid-row: span 2; width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe39b, var(--safran) 55%, var(--safran-fonce));
  display: grid; place-items: center; color: var(--prusse); font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.tresor-valeur { font-size: var(--t-xl); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: #fff; }
.tresor-valeur.saute { animation: saute .5s cubic-bezier(.3,1.8,.5,1); }
.tresor small { color: #9fb6c8; font-size: var(--t-xs); }
@keyframes saute { 40% { transform: scale(1.25); color: var(--safran); } }

.carnet h2 { font-size: var(--t-s); font-weight: 600; color: #9fb6c8; margin-bottom: 8px; }
.badges { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.badge {
  aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem;
  background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.16); filter: grayscale(1); opacity: .45;
}
.badge.obtenu { filter: none; opacity: 1; background: rgba(242,177,52,.16); border: 1px solid rgba(242,177,52,.5); }

.nav-jeux { display: grid; gap: 2px; }
.nav-jeux a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: #d5e1ea; text-decoration: none; font-weight: 500; font-size: var(--t-s);
}
.nav-jeux a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-jeux a[aria-current="page"] { background: rgba(242,177,52,.15); color: #fff; box-shadow: inset 3px 0 0 var(--safran); }
.nav-jeux .pastille { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.carnet-pied { margin-top: auto; font-size: var(--t-xs); color: #7f99ad; display: flex; gap: 10px; flex-wrap: wrap; }
.carnet-pied button { background: none; border: 0; color: #b9cad7; text-decoration: underline; font-size: var(--t-xs); }

/* ---------- Scène principale ---------- */
.scene { padding: 28px clamp(16px, 4vw, 48px) 60px; min-width: 0; }
.vue { max-width: 1180px; margin: 0 auto; }

/* ============================ Accueil ============================ */
.accueil-tete { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: stretch; margin-bottom: 34px; }
.accueil-titre h1 {
  font-size: var(--t-3xl); font-weight: 800; line-height: .98; letter-spacing: -.03em;
  font-stretch: 78%; color: var(--prusse); margin: 6px 0 16px;
}
.accueil-titre h1 .trait { display: block; font-family: var(--f-lecture); font-style: italic; font-weight: 400; font-stretch: 100%; letter-spacing: -.01em; color: var(--prusse-3); }
.accueil-titre p { font-family: var(--f-lecture); font-size: 1.15rem; line-height: 1.6; max-width: 46ch; color: #34414e; }
.salut { font-weight: 600; color: var(--gris); }

.enigme {
  position: relative; background: var(--prusse); color: #fff; border-radius: var(--r-l);
  padding: 24px 24px 22px; overflow: hidden; box-shadow: var(--ombre-flotte);
}
.enigme::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  border: 2px solid rgba(242,177,52,.35); border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(242,177,52,.07), 0 0 0 54px rgba(242,177,52,.04);
}
.enigme h2 { font-size: var(--t-s); font-weight: 600; color: var(--safran); }
.enigme-suite { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 16px; position: relative; z-index: 1; }
.enigme-suite span, .enigme-suite input {
  min-width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); padding: 0 10px;
}
.enigme-suite input { width: 84px; text-align: center; background: #fff; color: var(--prusse); border: 2px solid var(--safran); }
.enigme-pied { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.enigme-pied p { font-size: var(--t-s); color: #b9cad7; }
.enigme.resolue .enigme-suite input { background: var(--celadon); color: #fff; border-color: var(--celadon); }

.rayon-titre { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.rayon-titre h2 { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; color: var(--prusse); font-stretch: 85%; }
.rayon-titre p { color: var(--gris); font-size: var(--t-s); }

.mosaique { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 168px; gap: 14px; }
.tuile {
  --c: var(--safran);
  position: relative; grid-column: span 2; display: flex; flex-direction: column; justify-content: flex-end;
  text-align: left; padding: 18px; border-radius: var(--r-m); border: 1.5px solid var(--prusse);
  background: var(--papier); color: var(--encre); text-decoration: none; overflow: hidden;
  box-shadow: 4px 4px 0 var(--prusse); transition: transform .15s, box-shadow .15s;
}
.tuile:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--prusse); }
.tuile:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--prusse); }
.tuile.large { grid-column: span 4; grid-row: span 2; }
.tuile.haute { grid-row: span 2; }
.tuile-art { position: absolute; inset: 0 0 auto auto; width: 62%; height: 100%; pointer-events: none; }
.tuile.large .tuile-art { width: 58%; }
.tuile h3 { position: relative; font-size: var(--t-l); font-weight: 800; letter-spacing: -.015em; line-height: 1.1; font-stretch: 85%; }
.tuile.large h3 { font-size: var(--t-2xl); }
.tuile p { position: relative; font-size: var(--t-s); color: var(--gris); max-width: 34ch; margin-top: 4px; }
.tuile .etiquette {
  position: absolute; top: 14px; left: 14px; font-size: var(--t-xs); font-weight: 700;
  background: var(--c); color: var(--prusse); padding: 3px 10px; border-radius: 999px;
}
.tuile .avancement { position: relative; margin-top: 10px; height: 6px; border-radius: 6px; background: var(--calque); overflow: hidden; }
.tuile .avancement i { display: block; height: 100%; background: var(--c); border-radius: 6px; }

/* ============================ Composants ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--prusse); background: var(--blanc); color: var(--prusse);
  font-weight: 700; padding: 10px 18px; border-radius: 999px; font-size: var(--t-s);
  box-shadow: 0 2px 0 var(--prusse); transition: transform .1s, box-shadow .1s, background .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #fff7e2; }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--prusse); }
.btn-plein { background: var(--safran); }
.btn-plein:hover { background: #f6c055; }
.btn-sombre { background: var(--prusse); color: #fff; }
.btn-sombre:hover { background: var(--prusse-2); }
.btn-fantome { border-color: rgba(255,255,255,.3); background: transparent; color: #fff; box-shadow: none; }
.btn-fantome:hover { background: rgba(255,255,255,.1); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-icone { width: 42px; height: 42px; padding: 0; }

.jeu-tete {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1.5px solid var(--prusse);
}
.jeu-tete h1 { font-size: var(--t-2xl); font-weight: 800; letter-spacing: -.025em; color: var(--prusse); line-height: 1.05; font-stretch: 82%; }
.jeu-tete .sous { font-family: var(--f-lecture); font-style: italic; color: var(--gris); font-size: 1.05rem; margin-top: 4px; }
.retour { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); font-weight: 600; color: var(--gris); text-decoration: none; margin-bottom: 10px; }
.retour:hover { color: var(--prusse); }
.outils { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.compteur {
  display: inline-flex; align-items: center; gap: 10px; background: var(--blanc); border: 1.5px solid var(--prusse);
  border-radius: 999px; padding: 6px 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.jauge { height: 8px; border-radius: 8px; background: var(--ligne); overflow: hidden; min-width: 110px; }
.jauge i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }

.panneau { background: var(--papier); border: 1.5px solid var(--prusse); border-radius: var(--r-m); padding: 20px; }
.panneau h2 { font-size: var(--t-l); font-weight: 800; color: var(--prusse); letter-spacing: -.01em; margin-bottom: 10px; }
.lecture { font-family: var(--f-lecture); font-size: 1.08rem; line-height: 1.65; }

.champ { display: grid; gap: 6px; }
.champ label { font-weight: 600; font-size: var(--t-s); }
.champ input, .champ select {
  border: 1.5px solid var(--prusse); border-radius: 10px; padding: 11px 14px; background: #fff; font-size: 1rem; width: 100%;
}
.champ input:focus { outline: none; box-shadow: 0 0 0 4px rgba(242,177,52,.45); }
.champ .aide { font-size: var(--t-xs); color: var(--gris); }
.champ .erreur { font-size: var(--t-xs); color: var(--vermillon); font-weight: 600; min-height: 1em; }

/* ---------- Modale ---------- */
.voile {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 26, 40, .62); backdrop-filter: blur(4px);
  animation: apparait .2s ease;
}
.modale {
  position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--papier); border-radius: var(--r-l); border: 1.5px solid var(--prusse);
  box-shadow: var(--ombre-flotte); padding: 28px; animation: monte .3s cubic-bezier(.2,1.3,.4,1);
}
.modale.etroite { width: min(440px, 100%); text-align: center; }
.modale h2 { font-size: var(--t-xl); font-weight: 800; color: var(--prusse); letter-spacing: -.02em; margin-bottom: 8px; font-stretch: 85%; }
.modale-fermer {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--prusse); background: #fff; font-size: 1rem; line-height: 1;
}
.modale-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.modale.etroite .modale-actions { justify-content: center; }
@keyframes apparait { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(24px) scale(.97); opacity: 0; } }

/* ---------- Atelier d'avatar ---------- */
.atelier { display: grid; grid-template-columns: 170px 1fr; gap: 22px; align-items: start; }
.atelier-apercu { display: grid; gap: 10px; justify-items: center; position: sticky; top: 0; }
.atelier-apercu .rond { width: 150px; height: 150px; border-radius: 50%; overflow: hidden; border: 3px solid var(--prusse); background: var(--calque); }
.atelier-apercu .rond img, .atelier-apercu .rond svg { width: 100%; height: 100%; object-fit: cover; }
.formulaire { display: grid; gap: 16px; }
.formulaire .duo { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.onglets { display: flex; gap: 4px; background: var(--calque); padding: 4px; border-radius: 999px; width: max-content; max-width: 100%; }
.onglets button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: var(--t-s); }
.onglets button[aria-selected="true"] { background: var(--prusse); color: #fff; }
.galerie { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.galerie button {
  aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; padding: 0; overflow: hidden; background: var(--calque);
  transition: transform .15s;
}
.galerie button:hover { transform: scale(1.08); }
.galerie button[aria-pressed="true"] { border-color: var(--prusse); box-shadow: 0 0 0 3px var(--safran); }
.galerie svg { width: 100%; height: 100%; }
.reglages { display: grid; gap: 10px; }
.reglage { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: center; }
.reglage span { font-size: var(--t-s); font-weight: 600; }
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
.pastilles button {
  min-width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--ligne); background: #fff; padding: 0 8px; font-size: var(--t-s);
}
.pastilles button[aria-pressed="true"] { border-color: var(--prusse); box-shadow: 0 0 0 2px var(--safran); }
.depot {
  display: grid; place-items: center; gap: 8px; text-align: center; padding: 26px 16px; border-radius: var(--r-m);
  border: 2px dashed var(--prusse-3); background: #fff; color: var(--gris); cursor: pointer;
}
.depot.survol { background: #fff7e2; border-color: var(--safran-fonce); }
.depot b { color: var(--prusse); }

/* ---------- Toasts & confettis ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--prusse); color: #fff; padding: 10px 16px 10px 10px;
  border-radius: 999px; font-weight: 600; font-size: var(--t-s); box-shadow: var(--ombre-flotte);
  animation: toastIn .4s cubic-bezier(.2,1.4,.4,1), toastOut .4s ease 2.6s forwards;
}
.toast .piece-or { width: 30px; height: 30px; font-size: .72rem; grid-row: auto; }
.toast.badge-toast { background: var(--safran); color: var(--prusse); }
@keyframes toastIn { from { transform: translateY(20px) scale(.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(30px); opacity: 0; } }
.piece-volante {
  position: fixed; z-index: 90; width: 26px; height: 26px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #ffe39b, var(--safran) 55%, var(--safran-fonce));
  transition: transform .8s cubic-bezier(.5,-.3,.6,1), opacity .8s;
}
#confettis { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 9px; height: 15px; border-radius: 2px; animation: tombe linear forwards; }
@keyframes tombe { to { transform: translateY(110vh) rotate(720deg); opacity: .3; } }

/* ============================ Mots croisés ============================ */
.mc { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 24px; align-items: start; }
.mc-grille {
  --n: 10; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px;
  background: var(--prusse); padding: 3px; border-radius: var(--r-m); box-shadow: 6px 6px 0 var(--accent);
  aspect-ratio: 1; width: 100%;
}
.mc-case { position: relative; background: #fff; border-radius: 4px; }
.mc-case.noire { background: transparent; }
.mc-case .num { position: absolute; top: 2px; left: 4px; font-size: clamp(.5rem, 1.3vw, .66rem); font-weight: 700; color: var(--gris); pointer-events: none; z-index: 1; }
.mc-case input {
  width: 100%; height: 100%; border: 0; background: transparent; text-align: center; text-transform: uppercase;
  font-weight: 800; font-size: clamp(.9rem, 2.6vw, 1.45rem); color: var(--prusse); border-radius: 4px; caret-color: transparent;
}
.mc-case input:focus { outline: none; background: #fff2c7; }
.mc-case input.survol { background: #fdf6df; }
.mc-case input:focus.survol { background: #ffe08a; }
.mc-case input.trouve { background: var(--celadon-clair); color: #1d5d4b; }
.mc-case input.revele { background: #eceff8; color: var(--gris); }
.mc-case input.erreur { background: #fbd9d5; animation: secousse .35s; }
@keyframes secousse { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.indices { display: grid; gap: 16px; }
.indices h3 { font-size: var(--t-m); font-weight: 800; color: var(--prusse); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.indices ol { list-style: none; display: grid; gap: 2px; }
.indices li { font-family: var(--f-lecture); font-size: 1.02rem; line-height: 1.45; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.indices li b { font-family: var(--f-ui); color: var(--prusse); margin-right: 4px; }
.indices li:hover { background: #fff; }
.indices li.actif { background: #fff2c7; }
.indices li.fait { color: var(--gris); text-decoration: line-through; text-decoration-color: var(--celadon); }
.choix-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.choix-themes button {
  text-align: left; border: 1.5px solid var(--prusse); border-radius: var(--r-m); background: #fff; padding: 12px 14px;
  display: grid; gap: 2px;
}
.choix-themes button b { font-size: var(--t-m); }
.choix-themes button small { color: var(--gris); font-size: var(--t-xs); }
.choix-themes button span { font-size: 1.4rem; }
.choix-themes button[aria-pressed="true"] { background: var(--prusse); color: #fff; }
.choix-themes button[aria-pressed="true"] small { color: #b9cad7; }
.series { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.series button { border: 1.5px solid var(--prusse); border-radius: 999px; background: #fff; padding: 6px 12px; font-size: var(--t-s); font-weight: 600; }
.series button[aria-pressed="true"] { background: var(--safran); }

/* ============================ Géométrie ============================ */
.geo-onglets { margin-bottom: 18px; }
.geo { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.geo-liste { display: grid; gap: 4px; position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow-y: auto; padding-right: 4px; }
.geo-liste button {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; text-align: left;
  border: 1.5px solid transparent; background: none; padding: 6px 8px; border-radius: 10px; font-weight: 600; font-size: var(--t-s);
}
.geo-liste button:hover { background: #fff; }
.geo-liste button[aria-current="true"] { background: #fff; border-color: var(--prusse); }
.geo-liste svg { width: 34px; height: 34px; }
.geo-liste .etat { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ligne); display: grid; place-items: center; font-size: .7rem; }
.geo-liste .etat.ok { background: var(--celadon); border-color: var(--celadon); color: #fff; }
.geo-fiche { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; border: 1.5px solid var(--prusse); border-radius: var(--r-l); overflow: hidden; background: var(--papier); box-shadow: 6px 6px 0 var(--cobalt); }
.geo-dessin {
  background-color: #fbfdff; position: relative; min-height: 340px; display: grid; place-items: center; padding: 20px;
  background-image: linear-gradient(rgba(47,111,219,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(47,111,219,.12) 1px, transparent 1px);
  background-size: 20px 20px; border-right: 1.5px solid var(--prusse);
}
.geo-dessin svg { width: 100%; max-width: 420px; height: auto; overflow: visible; }
.geo-dessin .forme { fill: rgba(47,111,219,.14); stroke: var(--prusse); stroke-width: 2.2; stroke-linejoin: round; }
.geo-dessin .face2 { fill: rgba(47,111,219,.24); }
.geo-dessin .face3 { fill: rgba(47,111,219,.06); }
.geo-dessin .cache { fill: none; stroke: var(--prusse); stroke-width: 1.6; stroke-dasharray: 6 5; opacity: .7; }
.geo-dessin .cote { stroke: var(--vermillon); stroke-width: 1.8; fill: none; }
.geo-dessin .cote-txt { fill: var(--vermillon); font-family: var(--f-ui); font-weight: 800; font-size: 15px; paint-order: stroke; stroke: #fbfdff; stroke-width: 5px; }
.geo-dessin .angle { fill: none; stroke: var(--prusse); stroke-width: 1.5; }
.geo-dessin .base-col { fill: rgba(242,177,52,.35); }
.geo-corps { padding: 24px; display: grid; gap: 14px; align-content: start; }
.geo-corps h2 { font-size: var(--t-2xl); font-weight: 800; color: var(--prusse); letter-spacing: -.025em; line-height: 1; font-stretch: 82%; }
.geo-corps .enonce { font-family: var(--f-lecture); font-size: 1.1rem; line-height: 1.6; }
.geo-corps .enonce b { font-family: var(--f-ui); color: var(--vermillon); }
.formule {
  font-family: var(--f-lecture); font-size: 1.3rem; background: var(--prusse); color: #fff; padding: 10px 16px; border-radius: 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.formule em { color: var(--safran); font-style: italic; }
.formule.voilee { background: repeating-linear-gradient(135deg, var(--calque) 0 10px, #fff 10px 20px); color: var(--gris); font-family: var(--f-ui); font-size: var(--t-s); border: 1.5px dashed var(--prusse-3); }
.reponse { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.reponse input { flex: 1 1 140px; border: 2px solid var(--prusse); border-radius: 12px; padding: 10px 14px; font-size: 1.25rem; font-weight: 700; min-width: 0; }
.reponse .unite { display: grid; place-items: center; padding: 0 12px; font-weight: 700; color: var(--gris); }
.retour-geo { border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: var(--t-s); }
.retour-geo.bon { background: var(--celadon-clair); color: #1d5d4b; }
.retour-geo.faux { background: #fbe1dd; color: #8c2a21; }
.retour-geo .detail { font-family: var(--f-lecture); font-weight: 400; font-size: 1rem; display: block; margin-top: 4px; }
.niveau-geo { font-size: var(--t-xs); font-weight: 700; color: var(--cobalt); }

/* ============================ Frise ============================ */
.frise-pioche { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 22px; }
.evt {
  text-align: left; border: 1.5px solid var(--prusse); background: #fff; border-radius: var(--r-m); padding: 12px 14px;
  font-family: var(--f-lecture); font-size: 1.02rem; line-height: 1.35; box-shadow: 0 3px 0 var(--prusse); transition: transform .12s;
}
.evt:hover { transform: translateY(-2px); }
.evt.pose { opacity: .25; pointer-events: none; }
.frise { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding-top: 30px; }
.frise::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 4px; background: var(--prusse); border-radius: 4px; }
.frise::after { content: ""; position: absolute; right: -6px; top: 6px; border: 8px solid transparent; border-left: 12px solid var(--prusse); }
.creneau {
  position: relative; min-height: 116px; border: 2px dashed var(--prusse-3); border-radius: var(--r-m); padding: 10px;
  font-family: var(--f-lecture); font-size: .98rem; line-height: 1.35; background: rgba(255,255,255,.5);
}
.creneau::before { content: attr(data-rang); position: absolute; top: -26px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; background: var(--vermillon); color: #fff; font: 700 .75rem/22px var(--f-ui); text-align: center; }
.creneau.rempli { border-style: solid; background: #fff; cursor: pointer; }
.creneau.juste { border-color: var(--celadon); background: var(--celadon-clair); }
.creneau.faux { border-color: var(--vermillon); background: #fbe1dd; }
.creneau .annee { display: block; font-family: var(--f-ui); font-weight: 800; font-size: 1.2rem; color: var(--prusse); margin-top: 6px; }

/* ============================ Suites ============================ */
.suite-plateau { display: grid; justify-items: center; gap: 22px; padding: 30px 20px; }
.suite-termes { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.terme {
  min-width: 74px; height: 84px; padding: 0 14px; display: grid; place-items: center; border-radius: 16px;
  background: #fff; border: 1.5px solid var(--prusse); font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 0 var(--prusse); color: var(--prusse); animation: monte .4s backwards;
}
.terme.inconnu { background: var(--lilas); color: #fff; border-style: dashed; }
.propositions { display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr)); gap: 10px; width: min(560px, 100%); }
.propositions button { height: 64px; border-radius: 14px; border: 1.5px solid var(--prusse); background: #fff; font-size: 1.4rem; font-weight: 800; box-shadow: 0 3px 0 var(--prusse); }
.propositions button:hover { background: #f1eefe; }
.propositions button.bon { background: var(--celadon); color: #fff; }
.propositions button.faux { background: var(--vermillon); color: #fff; }
.explication { font-family: var(--f-lecture); font-size: 1.1rem; text-align: center; max-width: 52ch; min-height: 1.6em; }

/* ============================ Mot mystère ============================ */
.mm { display: grid; justify-items: center; gap: 18px; }
.mm-indice { font-family: var(--f-lecture); font-size: 1.2rem; text-align: center; max-width: 50ch; }
.mm-indice small { display: block; font-family: var(--f-ui); font-size: var(--t-s); color: var(--gris); margin-bottom: 4px; }
.mm-grille { display: grid; gap: 6px; }
.mm-ligne { display: grid; grid-auto-flow: column; gap: 6px; }
.mm-ligne.secoue { animation: secousse .35s; }
.mm-lettre {
  width: clamp(40px, 9vw, 56px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px;
  border: 2px solid var(--ligne); background: #fff; font-size: 1.5rem; font-weight: 800; text-transform: uppercase; color: var(--prusse);
}
.mm-lettre.rempli { border-color: var(--prusse); }
.mm-lettre.bien { background: var(--celadon); border-color: var(--celadon); color: #fff; }
.mm-lettre.mal { background: var(--safran); border-color: var(--safran); color: var(--prusse); }
.mm-lettre.absent { background: #8795a3; border-color: #8795a3; color: #fff; }
.mm-lettre.revele { animation: retourne .5s backwards; }
@keyframes retourne { 0% { transform: rotateX(90deg); } }
.clavier { display: grid; gap: 6px; width: min(560px, 100%); }
.clavier div { display: flex; gap: 5px; justify-content: center; }
.clavier button { flex: 1; max-width: 46px; height: 52px; border-radius: 8px; border: 0; background: #d3dbe1; font-weight: 800; color: var(--prusse); }
.clavier button.large { max-width: 76px; flex: 1.6; font-size: var(--t-xs); }
.clavier button.bien { background: var(--celadon); color: #fff; }
.clavier button.mal { background: var(--safran); }
.clavier button.absent { background: #8795a3; color: #fff; }

/* ============================ Vrai / faux ============================ */
.vf { display: grid; justify-items: center; gap: 22px; }
.chrono { position: relative; width: 120px; height: 120px; }
.chrono svg { transform: rotate(-90deg); }
.chrono circle { fill: none; stroke-width: 10; }
.chrono .fond { stroke: var(--ligne); }
.chrono .reste { stroke: var(--safran); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.chrono b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: var(--prusse); font-variant-numeric: tabular-nums; }
.affirmation {
  width: min(640px, 100%); min-height: 150px; display: grid; place-items: center; text-align: center; padding: 26px;
  background: #fff; border: 1.5px solid var(--prusse); border-radius: var(--r-l); box-shadow: 6px 6px 0 var(--prusse);
  font-family: var(--f-lecture); font-size: 1.35rem; line-height: 1.45;
}
.affirmation.bon { box-shadow: 6px 6px 0 var(--celadon); }
.affirmation.faux { box-shadow: 6px 6px 0 var(--vermillon); animation: secousse .35s; }
.vf-boutons { display: flex; gap: 14px; }
.vf-boutons button { width: 150px; height: 64px; border-radius: 999px; border: 1.5px solid var(--prusse); font-size: 1.2rem; font-weight: 800; box-shadow: 0 4px 0 var(--prusse); }
.vf-boutons .vrai { background: var(--celadon); color: #fff; }
.vf-boutons .faux { background: var(--vermillon); color: #fff; }
.combo { font-weight: 800; color: var(--safran-fonce); min-height: 1.5em; }
.bilan { display: grid; gap: 6px; width: min(640px, 100%); }
.bilan div { font-family: var(--f-lecture); padding: 8px 12px; border-radius: 10px; background: #fff; border-left: 4px solid var(--celadon); }
.bilan div.rate { border-left-color: var(--vermillon); }
.bilan small { display: block; font-family: var(--f-ui); color: var(--gris); }

.demarrage { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 30px 20px; }
.demarrage p { font-family: var(--f-lecture); font-size: 1.1rem; max-width: 50ch; }

/* ============================ Responsive ============================ */
@media (max-width: 1080px) {
  .mosaique { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tuile.large { grid-column: span 4; }
  .geo { grid-template-columns: 1fr; }
  .geo-liste { position: static; max-height: none; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (max-width: 900px) {
  .coque { grid-template-columns: 1fr; }
  .carnet {
    position: sticky; top: 0; z-index: 40; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px;
    overflow: visible;
  }
  .carnet .marque small, .carnet .badges-bloc, .carnet .nav-bloc, .carnet-pied, .portrait-titre, .portrait-niveau { display: none; }
  .portrait { grid-template-columns: auto auto; align-items: center; gap: 10px; margin-left: auto; text-align: left; padding: 0; }
  .portrait-cadre { width: 54px; height: 54px; }
  .portrait-image { inset: 5px; }
  .portrait-anneau circle { stroke-width: 9; }
  .portrait-crayon { width: 20px; height: 20px; font-size: .6rem; right: -2px; bottom: -2px; box-shadow: 0 0 0 2px var(--prusse); }
  .portrait-nom { font-size: var(--t-s); }
  .tresor { padding: 6px 10px; gap: 0 8px; }
  .tresor .piece-or { width: 28px; height: 28px; font-size: .7rem; }
  .tresor-valeur { font-size: var(--t-m); }
  .accueil-tete, .mc, .geo-fiche { grid-template-columns: 1fr; }
  .geo-dessin { border-right: 0; border-bottom: 1.5px solid var(--prusse); min-height: 260px; }
  .frise { grid-template-columns: 1fr; padding-top: 0; padding-left: 34px; }
  .frise::before { left: 10px; right: auto; top: 0; bottom: 0; width: 4px; height: auto; }
  .frise::after { display: none; }
  .creneau { min-height: 64px; }
  .creneau::before { top: 50%; left: -34px; transform: translateY(-50%); }
}
@media (max-width: 600px) {
  .mosaique { grid-template-columns: 1fr 1fr; grid-auto-rows: 150px; }
  .tuile, .tuile.large { grid-column: span 2; }
  .tuile.large { grid-row: span 2; }
  .tuile.haute { grid-row: span 1; }
  .tresor small, .marque b { display: none; }
  .atelier { grid-template-columns: 1fr; }
  .atelier-apercu { position: static; }
  .galerie { grid-template-columns: repeat(4, 1fr); }
  .formulaire .duo { grid-template-columns: 1fr; }
  .propositions { grid-template-columns: repeat(2, 1fr); }
  .vf-boutons button { width: 130px; }
  .modale { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Ajustements : illustrations des tuiles et énigme ---------- */
.enigme { align-self: start; }
.tuile .tuile-art { top: 0; right: 0; left: auto; bottom: auto; width: 52%; height: 60%; }
.tuile.large .tuile-art { width: 50%; height: 82%; top: 6%; }
.tuile.haute .tuile-art { width: 70%; height: 42%; }
.tuile h3, .tuile p, .tuile .avancement { z-index: 1; }
@media (max-width: 600px) {
  .tuile .tuile-art { width: 46%; height: 52%; }
  .tuile.large .tuile-art { width: 60%; height: 54%; top: 4%; }
  .tuile.haute .tuile-art { width: 46%; height: 52%; }
}
@media (max-width: 600px) {
  .mosaique { grid-auto-rows: 178px; }
  .tuile .tuile-art, .tuile.haute .tuile-art { width: 44%; height: 44%; top: 2%; }
  .tuile.large .tuile-art { height: 50%; }
}

/* ============================ Mathématiques ============================ */
.badges { grid-template-columns: repeat(6, 1fr); }
.mosaique { grid-auto-flow: dense; }
.m-onglets { flex-wrap: wrap; border-radius: 16px; }
.m-fiche { box-shadow: 6px 6px 0 #c2417a; }
.m-liste button { grid-template-columns: 40px 1fr auto; }
.m-niv { font-size: .7rem; font-weight: 800; color: #fff; background: #c2417a; border-radius: 6px; padding: 3px 0; text-align: center; }
.m-theoreme {
  font-family: var(--f-lecture); font-size: 1.04rem; line-height: 1.55; padding: 12px 14px 12px 16px; border-radius: 12px;
  background: #fbeff5; border-left: 4px solid #c2417a;
}
.m-theoreme b { font-family: var(--f-lecture); color: #8d2456; }
.m-eq { font-family: var(--f-lecture); font-size: 1.15em; white-space: nowrap; }
.m-eq i, .m-consigne i, .m-qcm i, .detail i { font-family: var(--f-lecture); }
.geo-dessin .m-pt, .m-visuel .m-pt { font-family: var(--f-ui); font-weight: 800; font-size: 14px; fill: var(--prusse); }
.geo-dessin .m-aire, .m-visuel .m-aire { font-family: var(--f-lecture); font-style: italic; font-size: 17px; fill: var(--prusse); }
.m-visuel .cote-txt { fill: var(--vermillon); font-family: var(--f-ui); font-weight: 800; font-size: 14px; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.m-visuel .forme { fill: rgba(47,111,219,.14); stroke: var(--prusse); stroke-width: 2; }
.m-choix .btn { min-width: 110px; }
.m-qcm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-qcm .btn { font-family: var(--f-lecture); font-size: 1.2rem; font-weight: 500; white-space: normal; border-radius: 14px; padding: 14px; }
.btn.m-bon { background: var(--celadon); color: #fff; border-color: var(--celadon); }
.btn.m-faux { background: var(--vermillon); color: #fff; border-color: var(--vermillon); }
.btn[disabled].m-bon, .btn[disabled].m-faux { opacity: 1; }
.m-form input { min-width: 70px; }
.m-coefs input { flex: 0 1 84px; text-align: center; }
.m-coefs .m-eq { display: grid; place-items: center; font-size: 1.3rem; }
.m-note { font-size: var(--t-xs); color: var(--gris); }
.m-atelier { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.m-exo { display: grid; gap: 16px; box-shadow: 6px 6px 0 #c2417a; border-radius: var(--r-l); padding: 24px; }
.m-consigne { font-size: 1.15rem; font-weight: 600; }
.m-consigne .m-eq { display: block; font-size: 2rem; color: var(--prusse); margin-top: 6px; white-space: normal; line-height: 1.2; }
.m-visuel {
  display: grid; place-items: center; min-height: 120px; border-radius: 14px; padding: 12px;
  background-color: #fbfdff; background-image: linear-gradient(rgba(47,111,219,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(47,111,219,.1) 1px, transparent 1px); background-size: 20px 20px;
}
.m-visuel:empty { display: none; }
.m-visuel > svg { width: 100%; max-width: 380px; height: auto; overflow: visible; }
.m-visuel .m-courbe { stroke-dasharray: 1600; animation: trace 1.2s ease-out; }
@keyframes trace { from { stroke-dashoffset: 1600; } }
.m-delta { font-family: var(--f-lecture); font-size: 1.6rem; color: var(--prusse); text-align: center; }
.m-delta small { display: block; font-family: var(--f-ui); font-size: var(--t-s); color: var(--gris); margin-top: 4px; }
.m-balance { position: relative; width: 100%; max-width: 420px; }
.m-balance svg { width: 100%; height: auto; }
.m-fleau { transform-origin: 160px 58px; transition: transform 1s cubic-bezier(.3,1.6,.4,1); }
.m-plateaux { position: absolute; left: 0; right: 0; top: 56%; display: flex; justify-content: space-between; transition: transform 1s; }
.m-plateaux span {
  width: 42%; text-align: center; font-family: var(--f-lecture); font-size: 1.25rem; font-weight: 600; color: var(--prusse);
  background: #fff; border: 1.5px solid var(--prusse); border-radius: 10px; padding: 4px 6px; transition: transform 1s cubic-bezier(.3,1.6,.4,1);
}
.m-equilibre { text-align: center; font-weight: 700; color: #1d5d4b; margin-top: 6px; }
.m-cours h2 { color: #c2417a; }
.m-cours ul, .m-cours ol { padding-left: 1.2em; display: grid; gap: 6px; margin: 8px 0; }
.m-cours p { margin: 6px 0; }
@media (max-width: 900px) {
  .m-atelier { grid-template-columns: 1fr; }
  .m-qcm { grid-template-columns: 1fr; }
  .m-consigne .m-eq { font-size: 1.6rem; }
}
.m-form .unite { white-space: nowrap; }
