:root {
  --fond: #f7f2ea;
  --carte: #ffffff;
  --texte: #2b2320;
  --doux: #6d625c;
  --trait: #e6dccf;
  --accent: #8e1b2b;
  --accent-clair: #f6e3e5;
  --surbrillance: #ffcf33;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(43, 35, 32, .06), 0 4px 16px rgba(43, 35, 32, .06);
}

* { box-sizing: border-box; }
/* « hidden » doit toujours cacher, même un élément qui a son propre display (ex. .legende en flex). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  background: var(--fond);
}

/* ---------- En-tête ---------- */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px;
  padding: 12px 20px;
  background: #2b2320; color: #fff;
}
.marque { display: flex; align-items: center; gap: 12px; }
.marque-logo { font-size: 28px; }
.marque h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.marque p { margin: 0; font-size: 13px; color: #d9cfc6; }
.onglets { display: flex; flex-wrap: wrap; gap: 6px; }
.onglets button {
  border: 1px solid #5a4b45; background: transparent; color: #f1e9e2;
  padding: 7px 14px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer;
}
.onglets button:hover { background: #3d322e; }
.onglets button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Mise en page ---------- */
.page {
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 20px;
  max-width: 1400px; margin: 0 auto; padding: 20px;
}
.page.mode-comparatif { grid-template-columns: 1fr; }
.colonne-planche { min-width: 0; }

/* ---------- Animal en 3D ---------- */
.planche {
  position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 300px;
  border-radius: var(--rayon); box-shadow: var(--ombre); overflow: hidden;
  background: radial-gradient(ellipse at 50% 38%, #fffaf3 0%, #f3eadf 55%, #e5d6c4 100%);
}
.toile3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.toile3d:active { cursor: grabbing; }
.outils3d { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.outils3d button {
  border: 1px solid var(--trait); background: var(--carte); color: var(--texte);
  padding: 5px 12px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer;
}
.outils3d button:hover { border-color: var(--accent); color: var(--accent); }
.outils3d button[aria-pressed="true"] { background: #2b2320; border-color: #2b2320; color: #fff; }
.etiquettes3d { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.etiquettes3d span {
  position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform;
  font: 700 11.5px/16px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff; padding: 0 3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8), 0 0 2px rgba(0, 0, 0, .7);
}
.etiquettes3d.os span { color: #2b2320; text-shadow: 0 0 3px #fff, 0 0 2px #fff, 0 1px 1px rgba(255, 255, 255, .9); }
.liste-pieces h2.sous { margin-top: 10px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--accent); }
.note-mrs { font-size: 13px; color: #7a4b00; background: #fff4dc; border-radius: 8px; padding: 8px 10px; }
.os-lien a, .transfo a { color: var(--accent); }
.source { font-size: 12px; color: var(--doux); margin-top: 14px; }
.etiquettes3d span.actif { color: #2b2320; background: #ffd25e; border-radius: 4px; text-shadow: none; }
.outils3d button[data-zoom] { width: 32px; padding: 5px 0; font-weight: 700; }
.aide3d {
  position: absolute; z-index: 2; right: 12px; top: 10px; margin: 0; pointer-events: none;
  font-size: 12px; color: var(--doux); background: rgba(255, 255, 255, .7); padding: 3px 9px; border-radius: 999px;
}
.couleurs3d { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 10px 2px 0; font-size: 13px; }
.couleurs3d .titre { color: var(--doux); }
.pastille { display: inline-flex; align-items: center; gap: 6px; }
.pastille::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.pastille.neutre::before { background: #cbbcae; }

.bulle {
  position: fixed; z-index: 50; pointer-events: none;
  background: #2b2320; color: #fff; padding: 4px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 12px));
}

/* ---------- Légende / filtres ---------- */
.legende { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 6px; }
.legende .titre { font-size: 13px; color: var(--doux); margin-right: 4px; }
.puce {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--trait); background: var(--carte); color: var(--texte);
  padding: 4px 11px; border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.puce::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, #999); }
.puce:hover { border-color: var(--c, #999); }
.puce[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.puce[aria-pressed="true"]::before { background: #fff; }
.puce.statique { cursor: default; }
.puce.effacer { --c: #6d625c; }
.puce.effacer::before { display: none; }

.liste-pieces { margin-top: 10px; }
.liste-pieces h2 { font-size: 13px; font-weight: 600; color: var(--doux); margin: 8px 0 6px; text-transform: uppercase; letter-spacing: .6px; }
.liste-pieces .grille { display: flex; flex-wrap: wrap; gap: 6px; }
.liste-pieces button {
  border: 1px solid var(--trait); background: var(--carte); color: var(--texte);
  padding: 5px 10px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer;
}
.liste-pieces button:hover { border-color: var(--accent); }
.liste-pieces button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.liste-pieces button.attenue { opacity: .4; }

/* ---------- Panneau de détail ---------- */
.panneau {
  align-self: start; position: sticky; top: 84px;
  max-height: calc(100vh - 104px); overflow: auto;
  background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 20px 22px;
}
.panneau .kicker { font-size: 12px; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.panneau h2 { margin: 2px 0 4px; font-size: 26px; line-height: 1.15; }
.panneau .alias { margin: 0 0 10px; color: var(--doux); font-size: 13px; }
.panneau h3 {
  margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .7px; color: var(--doux);
  border-bottom: 1px solid var(--trait); padding-bottom: 4px;
}
.panneau p { margin: 6px 0; }
.type { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 6px; margin-right: 6px; }
.type.rapide { background: #fff1e6; color: #a8461a; }
.type.lente { background: #efe9f8; color: #5f2b86; }
.type.mixte { background: #e8f3ea; color: #2d6a3a; }
.type.abat { background: #f1ece8; color: #5c4a42; }
.cuissons { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.conseil {
  margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid var(--accent);
  background: var(--accent-clair); border-radius: 0 10px 10px 0;
}
.conseil strong { color: var(--accent); }
.transfo { list-style: none; margin: 0; padding: 0; }
.transfo li { padding: 7px 0; border-bottom: 1px dashed var(--trait); }
.transfo li:last-child { border-bottom: 0; }
.transfo b { display: block; }
.transfo span { color: var(--doux); font-size: 14px; }

details.recette {
  border: 1px solid var(--trait); border-radius: 10px; margin-bottom: 8px; background: #fffdfa;
}
details.recette summary {
  cursor: pointer; padding: 10px 12px; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
}
details.recette summary::-webkit-details-marker { display: none; }
details.recette summary::before { content: "▸"; color: var(--accent); margin-right: 2px; }
details.recette[open] summary::before { content: "▾"; }
details.recette summary .nom { flex: 1; }
details.recette summary small { color: var(--doux); font-weight: 400; white-space: nowrap; }
.recette .corps { padding: 0 14px 12px; font-size: 14px; }
.recette ul, .recette ol { margin: 6px 0; padding-left: 20px; }
.recette li { margin: 2px 0; }
.recette .client { margin-top: 8px; padding: 8px 10px; background: #f3f7ee; border-radius: 8px; }

.equivalences { display: grid; gap: 8px; }
.equivalences .ligne { display: grid; grid-template-columns: 72px 1fr; gap: 8px; font-size: 14px; }
.equivalences .animal { font-weight: 700; }
.equivalences a { color: var(--accent); }
.equivalences .muscles { color: var(--doux); font-size: 13px; }

.accueil h2 { font-size: 22px; }
.accueil .pas { display: grid; gap: 8px; margin: 12px 0; }
.accueil .pas div { display: flex; gap: 10px; align-items: flex-start; }
.accueil .pas b { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; }
.definitions { display: grid; gap: 6px; font-size: 14px; }
.definitions div { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: start; }

.lien-bouton { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ---------- Comparatif ---------- */
.comparatif { grid-column: 1 / -1; }
.comparatif h2 { margin: 0 0 4px; }
.comparatif > p { margin: 0 0 14px; color: var(--doux); }
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--carte); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); }
.tableau th, .tableau td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
.tableau thead th { background: #2b2320; color: #fff; font-size: 14px; }
.tableau tbody th { width: 150px; background: #fbf7f1; font-size: 14px; }
.tableau td button { all: unset; cursor: pointer; display: block; }
.tableau td button:hover .region-nom, .tableau td button:focus-visible .region-nom { text-decoration: underline; }
.tableau .region-nom { font-weight: 700; color: var(--accent); }
.tableau ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.tableau .note { font-size: 12px; color: var(--doux); }
.c-boeuf { background: #fbecec; } .c-veau { background: #f2f6e6; } .c-porc { background: #f8eaf4; } .c-agneau { background: #fbf6dc; }

.pied { max-width: 1400px; margin: 0 auto; padding: 4px 20px 24px; font-size: 12px; color: var(--doux); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .panneau { position: static; max-height: none; }
  .entete { padding: 10px 12px; position: static; }
  .marque p { display: none; }
  .planche { aspect-ratio: 4 / 3.2; }
  .aide3d { font-size: 11px; }
  .tableau, .tableau tbody, .tableau tr, .tableau th, .tableau td { display: block; width: 100%; }
  .tableau thead { display: none; }
  .tableau td::before { content: attr(data-animal); display: block; font-size: 12px; font-weight: 700; color: var(--doux); text-transform: uppercase; }
}

/* ---------- Classeur de découpe (dénominations ★, fiches magasin) ---------- */
.note-etoiles { font-size: 13px; color: var(--doux); }
.etoiles { color: #c98a00; letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.etoiles i { font-style: normal; color: #e3d8c8; }
.classeur { list-style: none; margin: 0; padding: 0; }
.classeur li { padding: 8px 0; border-bottom: 1px dashed var(--trait); }
.classeur li:last-child { border-bottom: 0; }
.classeur .denom b { font-size: 15px; }
.classeur .mention { font-size: 12px; font-weight: 600; color: #2d6a3a; background: #e8f3ea; border-radius: 6px; padding: 1px 7px; margin-left: 4px; }
.classeur .morceau { font-weight: 600; font-size: 14px; }
.classeur .morceau small { font-weight: 400; color: var(--doux); }
.classeur span:not(.etoiles):not(.mention) { color: var(--doux); font-size: 14px; }
.petits-noms { font-size: 14px; }
details.fiche-magasin { border: 1px solid var(--trait); border-radius: 10px; margin: 8px 0; background: #fffdfa; }
details.fiche-magasin summary { cursor: pointer; padding: 8px 12px; font-weight: 600; font-size: 14px; list-style: none; }
details.fiche-magasin summary::-webkit-details-marker { display: none; }
details.fiche-magasin summary::before { content: "▸ "; color: var(--accent); }
details.fiche-magasin[open] summary::before { content: "▾ "; }
details.fiche-magasin dl { margin: 0; padding: 0 14px 10px; display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; font-size: 14px; }
details.fiche-magasin dt { font-weight: 700; color: var(--accent); }
details.fiche-magasin dd { margin: 0; }
.classeur-os { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid #c98a00; background: #fff6df; border-radius: 0 10px 10px 0; font-size: 14px; }
.classeur-os strong { color: #8a5d00; }

/* ---------- Plongée sur un os : carte dans la vue 3D, noms des muscles ---------- */
.carte3d {
  margin: 8px 0 0; background: var(--carte); border-radius: 12px; box-shadow: var(--ombre); padding: 8px 10px; font-size: 13px;
}
/* une pièce ou un os choisi : l'aide (« glisse pour tourner ») laisse toute la vue à la 3D */
.planche.choix .aide3d { display: none; }
.carte3d .titre b { font-size: 15px; }
.carte3d .titre small { color: var(--doux); }
.carte3d .muscles-lies { margin: 3px 0 6px; }
.carte3d .muscles-lies a { color: var(--accent); font-weight: 600; }
.carte3d .actions { display: flex; flex-wrap: wrap; gap: 5px; }
.carte3d button {
  border: 1px solid var(--trait); background: var(--carte); color: var(--texte);
  padding: 3px 9px; border-radius: 7px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.carte3d button[aria-pressed="true"] { background: #2b2320; border-color: #2b2320; color: #fff; }
.carte3d .info { margin: 0; font-weight: 600; }
.etiquettes3d.muscles span { color: #fff; background: rgba(90, 22, 26, .78); border-radius: 4px; text-shadow: none; }
.etiquettes3d.muscles span.actif { background: #ffd25e; color: #2b2320; }
@media (max-width: 900px) {
  .carte3d { padding: 6px 8px; }
}
body.plein-ecran-3d .carte3d { margin: 0; border-radius: 0; box-shadow: none; }

/* ---------- Plein écran 3D : se plonger dans le squelette ---------- */
body.plein-ecran-3d { overflow: hidden; }
body.plein-ecran-3d .entete, body.plein-ecran-3d .panneau, body.plein-ecran-3d .pied,
body.plein-ecran-3d .liste-pieces, body.plein-ecran-3d .legende, body.plein-ecran-3d .couleurs3d { display: none !important; }
body.plein-ecran-3d .page { display: block; padding: 0; max-width: none; }
body.plein-ecran-3d .colonne-planche { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: #efe6da; }
body.plein-ecran-3d .planche { flex: 1; aspect-ratio: auto; min-height: 0; border-radius: 0; box-shadow: none; }
body.plein-ecran-3d .outils3d { margin: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: #2b2320; }
body.plein-ecran-3d .outils3d button { background: #3d322e; border-color: #5a4b45; color: #f1e9e2; }
body.plein-ecran-3d .outils3d button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
@media (max-width: 900px) {
  .aide3d { left: 8px; right: auto; max-width: calc(100% - 16px); }
}

/* Liens vers la page atelier 3D */
.lien-atelier { margin: 10px 0; }
.lien-atelier a { display: inline-block; font-weight: 700; color: var(--accent); }
.bouton-lien {
  display: inline-block; border: 1px solid var(--accent); color: var(--accent); background: #fff; border-radius: 999px;
  padding: 6px 12px; font-weight: 600; text-decoration: none; font-size: 14px;
}
.carte3d .bouton-lien { padding: 4px 10px; font-size: 13px; }

/* ---------- Onglets Recettes et Mise en avant ---------- */
.vue-texte { grid-column: 1 / -1; max-width: 860px; width: 100%; margin: 0 auto; background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 18px 20px; }
.vue-texte[hidden] { display: none; }
.vue-texte h2 { margin: 0 0 8px; }
.vue-texte h3 { margin: 18px 0 6px; }
.vue-texte .note { color: var(--doux); }
.choix-animal { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.choix-animal a { border: 1px solid var(--trait); border-radius: 999px; padding: 5px 12px; color: var(--texte); text-decoration: none; font-weight: 600; }
.choix-animal a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.recette .avec { margin-top: 8px; font-size: 14px; color: var(--doux); }
.recette .avec a { color: var(--accent); }
.vers-recettes { margin: 12px 0; }
.vue-texte .idee { border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; margin: 8px 0; }
.vue-texte .idee p { margin: 2px 0; }
.vue-texte details.comment-faire { border: 1px solid var(--trait); border-radius: 10px; padding: 6px 10px; margin: 6px 0; }
.vue-texte details.comment-faire summary { font-weight: 700; cursor: pointer; }
.vue-texte .voir-mof a { color: var(--accent); font-weight: 600; }
.sources-repli { margin-top: 18px; font-size: 13px; color: var(--doux); }
.sources-repli summary { cursor: pointer; }
