/* La Constellation · prototype, tour de rupture : l'écran entier est le marquoir (DESIGN-v2.md). */

@font-face { font-family: 'Karla'; font-weight: 400; font-display: swap; src: url('vendor/polices/karla-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Karla'; font-weight: 400; font-display: swap; src: url('vendor/polices/karla-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+2C60-2C7F; }
@font-face { font-family: 'Karla'; font-weight: 600; font-display: swap; src: url('vendor/polices/karla-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Karla'; font-weight: 600; font-display: swap; src: url('vendor/polices/karla-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+2C60-2C7F; }
@font-face { font-family: 'Rozha One'; font-weight: 400; font-display: swap; src: url('vendor/polices/rozha-one-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC; }
@font-face { font-family: 'Rozha One'; font-weight: 400; font-display: swap; src: url('vendor/polices/rozha-one-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
  --nuit: #0B0F1C;
  --lin-indigo: #1B2540;
  --indigo-fiche: #111A30;
  --lin-ecru: #EFE6D2;
  --ecru-bande: #E9E1D0;
  --safran: #E1A72E;
  --garance: #B5302A;
  --texte-doux: #B9B3A6;
  --encre: #1B2540;
  --cadre: 10px;      /* marge de la bordure */
  --frise: 18px;      /* largeur de la frise */
  --dedans: calc(var(--cadre) + var(--frise) + 10px);
  --bande: 112px;
  --frise-h: url('matieres/frise-h.webp');
  --frise-v: url('matieres/frise-v.webp');
  --frise-coin: url('matieres/frise-coin.webp');
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  /* Le lin indigo du marquoir, plein écran ; le canvas three.js est transparent par-dessus. */
  background: #15203A url('matieres/lin-indigo.webp') repeat;
  background-size: 640px;
  color: var(--lin-ecru);
  font: 400 16px/1.45 'Karla', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
button, input, label { font: inherit; color: inherit; }
sup { font-size: 0.62em; line-height: 0; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--safran); outline-offset: 3px; }
.mobile { display: none !important; }

/* ---------- La bordure brodée ---------- */
.bordure { position: fixed; inset: var(--cadre); pointer-events: none; z-index: 40; }
/* La frise brodée du Designer (un losange safran, un losange garance, raccordée en longueur), tirée au double ;
   « round » ajuste le nombre de motifs à la longueur : pas de motif coupé. Les quatre coins : le carré garance. */
.bordure span { position: absolute; }
.b-haut, .b-bas { left: var(--frise); right: var(--frise); height: var(--frise); background: var(--frise-h) left center / auto 100% round no-repeat; }
.b-gauche, .b-droite { top: var(--frise); bottom: var(--frise); width: var(--frise); background: var(--frise-v) center top / 100% auto no-repeat round; }
.b-haut { top: 0; }
.b-droite { right: 0; }
.b-bas { bottom: 0; }
.b-gauche { left: 0; }
.b-coin { width: var(--frise); height: var(--frise); background: var(--frise-coin) center / 100% 100% no-repeat; }
.b-coin.hg { left: 0; top: 0; }
.b-coin.hd { right: 0; top: 0; }
.b-coin.bd { right: 0; bottom: 0; }
.b-coin.bg { left: 0; bottom: 0; }
/* L'aiguille de l'arrivée : elle mène la couture de la bordure, puis brode l'étoile de Camille. */
.aiguille { position: fixed; left: 0; top: 0; width: 120px; height: auto; z-index: 41; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.5)); }
.aiguille[hidden] { display: none; }

/* ---------- En-tête : marque, titre brodé, étiquettes tissées ---------- */
.tete {
  position: fixed; top: calc(var(--dedans) + 2px); left: var(--dedans); right: var(--dedans); z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 16px; pointer-events: none;
}
.tete > * { pointer-events: auto; }
.marque { margin: 6px 0 0; font-size: 15px; color: var(--texte-doux); white-space: nowrap; }
.marque .produit { color: var(--safran); font-weight: 600; }
.lien-liste { margin-top: 6px; padding: 6px 2px; min-height: 36px; background: none; border: 0; color: var(--lin-ecru); font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: underline dotted var(--safran); text-underline-offset: 5px; }
.titre-brode { display: block; justify-self: center; max-width: 100%; }
.actions { display: flex; gap: 12px; justify-content: flex-end; }

/* Une étiquette tissée : lin teinté sur trame visible, deux points de couture aux coins. */
.etiquette-bouton {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 4px; cursor: pointer; white-space: nowrap;
  font-weight: 600; font-size: 16px; text-decoration: none; border: 0;
  background-blend-mode: multiply; background-size: 160px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.3);
}
.etiquette-bouton::before, .etiquette-bouton::after {
  content: '×'; position: absolute; top: 2px; font-size: 11px; line-height: 1; opacity: 0.7;
}
.etiquette-bouton::before { left: 4px; }
.etiquette-bouton::after { right: 4px; }
.etiquette-bouton.ecru { background-color: var(--lin-ecru); background-image: url('matieres/lin-gris.webp'); color: var(--encre); outline: 1px solid var(--safran); outline-offset: -4px; }
.etiquette-bouton.garance { background-color: #B03A30; background-image: url('matieres/lin-gris.webp'); color: var(--lin-ecru); outline: 1px dashed rgba(239, 230, 210, 0.6); outline-offset: -4px; }
.etiquette-bouton.indigo { background-color: #2A3A66; background-image: url('matieres/lin-gris.webp'); color: var(--lin-ecru); outline: 1px dashed var(--safran); outline-offset: -5px; }
.etiquette-bouton:hover { filter: brightness(1.08); }
.etiquette-bouton .court { display: none; }
.large { width: 100%; }

/* ---------- La scène ---------- */
#principal { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0;
  /* la scène s'arrête à la frise et à la bande : aucune étoile ne déborde sur le cadre brodé */
  clip-path: inset(var(--haut-scene, 28px) calc(var(--cadre) + var(--frise)) calc(var(--bande) + var(--dedans)) calc(var(--cadre) + var(--frise))); }
#scene canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; transition: opacity 0.25s ease; }
#scene.fondu canvas { opacity: 0; }
#scene:focus-visible { outline-offset: -40px; }
.fil-etiquette { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.etiquettes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
body:not(.apercu) .etiquettes, body:not(.apercu) .fil-etiquette { clip-path: inset(var(--haut-scene, 28px) calc(var(--cadre) + var(--frise)) calc(var(--bande) + var(--dedans)) calc(var(--cadre) + var(--frise))); }
.etiquette { position: absolute; left: 0; top: 0; white-space: nowrap; font-weight: 600; font-size: 16px; line-height: 1.2; color: var(--lin-ecru); text-align: center; }
.etiquette .annees { display: block; font-weight: 400; font-size: 14px; color: var(--texte-doux); }
.etiquette.sans-annees .annees, .etiquette.prenom-seul .annees, .etiquette.prenom-seul .nomfam { display: none; }
.etiquette.en-ligne .annees { display: inline; margin-left: 6px; }
.etiquette .initiale, .etiquette.initiale-nom .prenom, .etiquette.initiale-nom .annees { display: none; }
.etiquette.initiale-nom .initiale { display: inline; }
.etiquette.racine { font: 400 26px/1.1 'Rozha One', Georgia, serif; }
.etiquette.choisie { color: #F0B847; }
.etiquette.tambour { font-weight: 400; font-size: 15px; }

/* ---------- L'étiquette cousue (fiche) ---------- */
.etiquette-cousue {
  position: fixed; left: 0; top: 0; z-index: 25; width: 300px; padding: 22px 22px 18px;
  color: var(--encre); background-color: var(--lin-ecru);
  background-image: linear-gradient(rgba(239, 230, 210, 0.6), rgba(239, 230, 210, 0.6)), url('matieres/lin-gris.webp');
  background-size: auto, 200px; background-blend-mode: normal, multiply;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease;
}
.etiquette-cousue[hidden] { display: none; }
/* Le point avant en garance, cousu à 7 px du bord (image du Designer recolorée en canvas). */
.etiquette-cousue::before, .bande::before, .carte::before {
  content: ''; position: absolute; inset: 7px; pointer-events: none;
  background: var(--pa-h) top left / 30px 6px repeat-x, var(--pa-h) bottom left / 30px 6px repeat-x,
    var(--pa-v) top left / 6px 30px repeat-y, var(--pa-v) top right / 6px 30px repeat-y;
}
.etiquette-cousue, .carte { --pa-h: var(--point-garance-h); --pa-v: var(--point-garance-v); }
.bande { --pa-h: var(--point-safran-h); --pa-v: var(--point-safran-v); }
.oeillet { position: absolute; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: #CFC4A8; box-shadow: inset 0 0 0 3px #8F7F5C; }
.etiquette-cousue.droite .oeillet { left: 10px; }
.etiquette-cousue.gauche .oeillet { right: 44px; }
.fermer { position: absolute; top: 4px; right: 6px; width: 36px; height: 36px; border: 0; background: none; cursor: pointer; font-size: 26px; line-height: 1; color: inherit; }
.fiche-sosa { margin: 6px 0 0; color: #8E2620; font-size: 16px; font-weight: 600; }
.fiche-nom { margin: 2px 0 10px; font: 400 30px/1.1 'Rozha One', Georgia, serif; overflow-wrap: anywhere; color: var(--encre); }
.faits { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 17px; }
.implexe, .vivant-note { font-size: 16px; margin: 10px 0 0; }
.implexe strong { color: #8E2620; }
.fil-siecle { font-size: 15px; color: #363B50; margin: 8px 0 0; }
.lien-nom { display: inline-block; margin-top: 10px; color: #8E2620; font-size: 16px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- La bande cousue du bas ---------- */
.bande {
  position: fixed; left: var(--dedans); right: var(--dedans); bottom: var(--dedans); height: var(--bande); z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 10px 150px 10px 18px;
  color: var(--encre); background: var(--ecru-bande) url('matieres/lin-gris.webp'); background-size: 220px; background-blend-mode: multiply;
  border-radius: 3px;
  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.45);
}
.commandes { display: flex; gap: 10px; }
.piece {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 72px; height: 72px;
  background: #F3ECDC url('matieres/lin-gris.webp'); background-size: 140px; background-blend-mode: multiply;
  border: 0; outline: 2px dashed rgba(27, 37, 64, 0.35); outline-offset: -5px; border-radius: 6px; cursor: pointer; font-size: 15px; color: var(--encre);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}
.piece.large-piece { width: auto; padding: 0 14px; white-space: nowrap; }
.piece.bureau { width: 64px; }
.piece[aria-pressed="true"], .piece[aria-expanded="true"] { outline-color: var(--garance); background-color: #F7E4CF; }
.picto { width: 26px; height: 26px; fill: none; stroke: var(--garance); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 3.2 2; }
.tiroir { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.generations { display: grid; gap: 4px; width: 160px; flex: none; }
.generations label { font-size: 16px; font-weight: 600; text-align: center; }
.generations input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; }
.generations input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: url('matieres/point-avant.webp') repeat-x center / 32px 6px; }
.generations input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #F2C25A, #B8801C); box-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.generations input[type="range"]::-moz-range-track { height: 6px; background: url('matieres/point-avant.webp') repeat-x center / 32px 6px; }
.generations input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #D9A23A; }
.echevettes { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; min-width: 0; }
.echevettes button { display: flex; flex-direction: column; align-items: center; gap: 0; background: none; border: 0; padding: 2px 4px; cursor: pointer; border-radius: 6px; color: var(--encre); }
.echevettes img { width: auto; height: 64px; }
.echevettes.filtre button:not([aria-pressed="true"]) img { opacity: 0.3; }
.echevettes span { font-size: 15px; white-space: nowrap; }
.echevettes button[aria-pressed="true"] span { text-decoration: underline 2px var(--garance); text-underline-offset: 3px; }
.oria { position: absolute; right: 8px; bottom: 6px; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; }
.oria img { width: auto; height: 120px; margin-bottom: -4px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35)); }
.bulle {
  position: absolute; right: 120px; bottom: 112px; width: max-content; max-width: 280px; margin: 0; padding: 9px 14px;
  font-size: 16px; line-height: 1.35; color: var(--encre);
  background: var(--lin-ecru) url('matieres/lin-gris.webp'); background-size: 180px; background-blend-mode: multiply;
  border-radius: 10px; outline: 1px dashed var(--safran); outline-offset: -4px; box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

/* ---------- La vue à plat : le disque à gauche, le carton (titre, villages, siècles, boutons) à droite ---------- */
.affiche { position: fixed; inset: var(--dedans); z-index: 30; display: grid; grid-template-columns: auto 320px; justify-content: center; align-items: center; gap: 24px; }
.affiche[hidden] { display: none; }
.feuille, .carton-plat { position: relative; background: #16213A url('matieres/lin-indigo.webp'); background-size: 420px; box-shadow: 0 16px 40px rgba(0,0,0,0.55); }
.feuille {
  width: min(calc(100vh - 2 * var(--dedans) - 8px), calc(100vw - 2 * var(--dedans) - 368px)); aspect-ratio: 1 / 1;
  display: flex; padding: 20px;
}
.feuille::before, .carton-plat::before { content: ''; position: absolute; inset: 8px; pointer-events: none; background: var(--frise-h) top left / 24px 12px repeat-x, var(--frise-h) bottom left / 24px 12px repeat-x, var(--frise-v) top left / 12px 24px repeat-y, var(--frise-v) top right / 12px 24px repeat-y; }
.carton-plat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 24px 22px; text-align: center; }
.feuille-titre { margin: 0; font: 400 30px/1.1 'Rozha One', Georgia, serif; text-align: center; overflow-wrap: anywhere; }
.feuille-sous-titre { margin: 4px 0 6px; font-size: 16px; color: var(--texte-doux); }
.ciel-affiche { position: relative; width: 100%; height: 100%; min-height: 0; }
.ciel-affiche canvas { display: block; width: 100%; height: 100%; }
.medaillons { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; }
.medaillons li { display: flex; flex-direction: column; align-items: center; width: 120px; text-align: center; font-size: 15px; line-height: 1.2; }
.medaillons img { width: 72px; height: 72px; }
.siecles-affiche { list-style: none; margin: 8px 0 0; padding: 6px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; border-top: 1px dashed rgba(225,167,46,0.5); }
.siecles-affiche li { display: flex; flex-direction: column; align-items: center; font-size: 15px; }
.siecles-affiche img { width: auto; height: 44px; }
.boutons-plat { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 14px; }
.boutons-plat .etiquette-bouton { justify-content: center; min-height: 48px; }
.pied { margin: 10px 0 0; display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--texte-doux); }
.pied img { width: 34px; height: 34px; }
/* #principal (fixe) fait son propre empilement : dans l'aperçu, il passe devant la feuille pour les noms. */
body.apercu #principal { z-index: 31; pointer-events: none; }
/* sur l'affiche, les noms croisent les orbites cousues : un halo de lin indigo les garde lisibles */
body.apercu .etiquette { text-shadow: 0 0 2px #1B2540, 0 0 4px #1B2540, 0 0 6px #1B2540; }
body.fiche-ouverte .bulle { display: none; }
body.apercu .bande, body.apercu .tete, body.apercu .fil-etiquette, body.apercu .etiquette-cousue { visibility: hidden; }

/* ---------- Liste des ancêtres ---------- */
.liste:not(.sr) {
  position: fixed; left: var(--dedans); top: 120px; bottom: calc(var(--bande) + var(--dedans) + 12px); width: min(460px, calc(100% - 2 * var(--dedans))); z-index: 35;
  color: var(--encre); background: var(--lin-ecru) url('matieres/lin-gris.webp'); background-size: 200px; background-blend-mode: multiply;
  outline: 2px dashed var(--garance); outline-offset: -8px; display: flex; flex-direction: column; box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}
.liste-tete { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 4px 20px; }
.liste-tete h2 { margin: 0; font-size: 20px; }
.liste .fermer { position: static; }
.liste ol { list-style: none; margin: 0; padding: 0 14px 14px; overflow-y: auto; }
.liste li button { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid rgba(27,37,64,0.12); padding: 8px; cursor: pointer; font-size: 16px; color: var(--encre); }
.liste .num { color: var(--garance); font-weight: 600; }

/* ---------- Accueil ---------- */
/* L'écran de dépôt est dans le marquoir : la frise, le titre brodé, et une étiquette de lin cousue, sans voile gris. */
.voile { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: transparent; padding: 120px calc(var(--cadre) + var(--frise) + 10px) 40px; overflow-y: auto; }
body.accueil .bande, body.accueil #ouvrir-liste, body.accueil .actions { visibility: hidden; }
.voile[hidden] { display: none; }
.carte {
  position: relative; width: min(560px, 100%); padding: 34px 34px 28px; text-align: center; color: var(--encre);
  background-color: var(--lin-ecru);
  background-image: linear-gradient(rgba(239, 230, 210, 0.6), rgba(239, 230, 210, 0.6)), url('matieres/lin-gris.webp');
  background-size: auto, 220px; background-blend-mode: normal, multiply;
  box-shadow: 0 2px 0 rgba(0,0,0,0.25), 0 18px 40px rgba(0,0,0,0.5); transform: rotate(-0.8deg);
}
.carte h2 { font: 400 32px/1.1 'Rozha One', Georgia, serif; margin: 8px 0 10px; }
.carte-oria { width: auto; height: 112px; }
.depot { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 18px 0 8px; }
.doux { color: #363B50; }
.petit { font-size: 15px; }
#qui h3 { font-size: 20px; margin: 18px 0 8px; }
.champs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: end; }
.champs label { display: grid; text-align: left; gap: 4px; font-size: 15px; }
.champs input { min-height: 44px; padding: 0 10px; border-radius: 4px; border: 1px solid rgba(27,37,64,0.4); background: #FBF7EE; color: var(--encre); width: 170px; }
.candidats { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.candidats button { width: 100%; min-height: 44px; background: rgba(181,48,42,0.08); border: 1px dashed var(--garance); border-radius: 4px; cursor: pointer; color: var(--encre); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bande) + var(--dedans) + 20px); transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100% - 32px));
  color: var(--encre); background: var(--lin-ecru); border-radius: 6px; padding: 12px 16px; font-size: 16px; outline: 1px dashed var(--garance); outline-offset: -4px;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.toast.visible { opacity: 1; }
.mesure { position: fixed; left: 50%; top: 4px; transform: translateX(-50%); margin: 0; z-index: 60; font-size: 14px; background: rgba(0,0,0,0.6); padding: 4px 10px; border-radius: 6px; }

/* ---------- Mobile (390 × 844) ---------- */
/* ---------- Le partage (seulement servi par le Worker, serveur/) ---------- */
.partage { border: 0; padding: 0; background: transparent; max-width: min(520px, calc(100% - 32px)); }
.partage::backdrop { background: rgba(11, 15, 28, 0.62); }
.carte-partage {
  color-scheme: light;
  position: relative; padding: 30px 30px 24px; color: var(--encre); background-color: var(--lin-ecru);
  background-image: linear-gradient(rgba(239, 230, 210, 0.6), rgba(239, 230, 210, 0.6)), url('matieres/lin-gris.webp');
  background-size: auto, 220px; background-blend-mode: normal, multiply; outline: 1px dashed var(--garance); outline-offset: -8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.carte-partage h2 { font: 400 28px/1.1 'Rozha One', Georgia, serif; margin: 0 0 10px; }
.carte-partage p { margin: 0 0 10px; }
.carte-partage .champ { display: grid; gap: 4px; margin: 12px 0; font-weight: 600; }
.carte-partage .champ input { min-height: 44px; padding: 0 10px; border-radius: 4px; border: 1px solid rgba(27, 37, 64, 0.4); background: #FBF7EE; color: var(--encre); font-weight: 400; }
.carte-partage .case { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 15px; }
.carte-partage .case input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--garance); flex: none; }
.carte-partage .message { min-height: 1.4em; font-weight: 600; color: #8E2620; }
.carte-partage .message.reussi { color: #2F5A2A; }
.carte-partage .boutons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin-top: 8px; }
.carte-partage .boutons[hidden] { display: none; }
.carte-partage a.etiquette-bouton { text-decoration: none; display: inline-flex; align-items: center; }
.carte-partage .univers-lien { margin: 14px 0 0; text-align: right; }
.carte-partage .univers-lien a { color: var(--garance-fonce, #8E2620); }

/* Servi par le Worker : partage et page en 3D ; « Télécharger » aussi dans le fichier autonome (image, et PDF en ligne),
   où le partage disparaît. Le prototype seul n'a ni l'un ni l'autre. */
.serveur-seul, .avec-telechargement { display: none; }
body.serveur .serveur-seul, body.serveur .avec-telechargement, body.fichier .avec-telechargement { display: inline-flex; }
li.serveur-seul { display: none !important; }
body.serveur li.serveur-seul { display: list-item !important; }
body.fichier #partager { display: none; }

/* ---------- Télécharger : la liste des formats ---------- */
.formats { list-style: none; margin: 6px 0 12px; padding: 0; display: grid; gap: 8px; }
.format {
  width: 100%; display: grid; gap: 2px; text-align: left; padding: 10px 14px; cursor: pointer; font: inherit; color: var(--encre);
  background: #FBF7EE; border: 1px solid rgba(27, 37, 64, 0.35); border-radius: 4px;
}
.format:hover, .format:focus-visible { border-color: var(--garance); outline: 2px solid var(--garance); outline-offset: 1px; }
.format strong { font-size: 17px; }
.format span { font-size: 14px; color: #4A4F63; }
.format[aria-busy="true"] { opacity: 0.6; cursor: progress; }
body.fichier .marque a { color: inherit; }

@media (max-width: 767px) {
  :root { --cadre: 6px; --frise: 10px; --dedans: 22px; --bande: 84px;
    --frise-h: url('matieres/frise-h-petite.webp'); --frise-v: url('matieres/frise-v-petite.webp'); --frise-coin: url('matieres/frise-coin-petit.webp'); }
  .mobile { display: flex !important; }
  .bureau { display: none !important; }
  .tete { grid-template-columns: 1fr auto; top: 16px; gap: 6px; }
  .tete-gauche { grid-column: 1; }
  .marque { font-size: 15px; }
  .marque > :not(.produit) { display: none; }
  .tete-gauche .lien-liste { display: none; }
  .actions { grid-column: 2; grid-row: 1; }
  #partager { display: none; }
  /* Servi par le Worker, le partage est réel : le bouton revient, en court, et la marque cède la place. */
  body.serveur #partager { display: inline-flex; }
  body.serveur .tete-gauche { display: none; }
  body.serveur .actions { grid-column: 1 / -1; justify-content: space-between; }
  .etiquette-bouton { min-height: 40px; padding: 0 12px; font-size: 15px; }
  body.serveur .actions { gap: 6px; }
  .etiquette-bouton .long { display: none; }
  .etiquette-bouton .court { display: inline; }
  .titre-brode { display: none; }
  #titre.sr { position: static !important; width: auto; height: auto; margin: 4px 0 0; clip: auto; overflow: visible; white-space: normal; }
  .etiquette.racine { font-size: 20px; }
  .etiquette { font-size: 14px; }
  #titre { grid-column: 1 / -1; grid-row: 2; text-align: center; font: 400 31px/1.08 'Rozha One', Georgia, serif; color: var(--lin-ecru); }
  .bande { padding: 10px 78px 10px 12px; gap: 0; }
  .commandes { gap: 6px; width: 100%; }
  .piece, .piece.large-piece { width: auto; flex: 1; height: 64px; font-size: 15px; padding: 0 2px; white-space: normal; }
  .picto { width: 24px; height: 24px; }
  .tiroir {
    position: fixed; left: var(--dedans); right: var(--dedans); bottom: calc(var(--bande) + var(--dedans) + 6px); height: auto; z-index: 21;
    flex-direction: column; align-items: stretch; gap: 10px; padding: 14px;
    color: var(--encre); background: var(--ecru-bande) url('matieres/lin-gris.webp'); background-size: 200px; background-blend-mode: multiply;
    outline: 2px dashed var(--garance); outline-offset: -6px; box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
  }
  .tiroir:not(.ouvert) { display: none; }
  .generations { width: 100%; }
  .echevettes { flex-wrap: wrap; justify-content: center; }
  .echevettes img { width: auto; height: 56px; }
  .lien-liste.mobile { justify-content: center; color: var(--encre); }
  .oria { right: 4px; bottom: 4px; }
  .oria img { width: auto; height: 72px; margin-bottom: -2px; }
  .bulle { right: 2px; bottom: 74px; max-width: 220px; font-size: 15px; }
  /* L'étiquette cousue monte depuis la bande ; sa hauteur réserve celle de son bouton. */
  .etiquette-cousue { left: var(--dedans) !important; right: var(--dedans); top: auto !important; bottom: calc(var(--bande) + var(--dedans) + 6px); width: auto; transform: none !important; max-height: 52vh; display: flex; flex-direction: column; }
  .etiquette-cousue[hidden] { display: none; }
  #fiche-corps { overflow-y: auto; min-height: 0; flex: 1; }
  .oeillet { display: none; }
  .fiche-nom { font-size: 26px; padding-right: 30px; }
  .affiche { grid-template-columns: 1fr; overflow-y: auto; align-items: start; justify-items: center; gap: 12px; padding: 4px 0 20px; }
  .feuille { width: 100%; padding: 12px; }
  .carton-plat { width: 100%; padding: 24px 16px 16px; }
  .feuille-titre { font-size: 24px; }
  .medaillons li { width: 100px; font-size: 13px; overflow-wrap: anywhere; }
  .medaillons img { width: 60px; height: 60px; }
  .siecles-affiche { gap: 8px; }
  .liste:not(.sr) { top: 70px; left: var(--dedans); right: var(--dedans); width: auto; }
  .toast { bottom: calc(var(--bande) + var(--dedans) + 12px); }
}

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