/* GeniMath — styles graphiques des fiches. Feuille A4 réelle (mm, pt) pour servir aussi à l'impression.
   Règles : aucune marque, aucune ligne ou case de réponse ajoutée ; les décorations restent à au moins
   5 mm du bord (zone imprimable) et ne modifient ni l'ordre, ni les colonnes, ni la hauteur des lignes. */
.fiche { box-sizing: border-box; position: relative; width: 210mm; height: 297mm; padding: 15mm 16mm 14mm; background: #fff; color: #1a1a1a; font-family: Arial, Helvetica, sans-serif; font-size: 11pt; line-height: 1.3; display: flex; flex-direction: column; overflow: hidden; }
.fiche *, .fiche *::before, .fiche *::after { box-sizing: border-box; }
.fiche h1, .fiche p { margin: 0; }
.fiche .fm-deco { position: absolute; pointer-events: none; }
.fiche .fm-head, .fiche .fm-body, .fiche .fm-exercise, .fiche .fm-stars { position: relative; z-index: 1; }

/* Calculs : signe moins typographique, opérateurs espacés, chiffres alignés */
.fiche .fm-expr { display: inline-flex; align-items: baseline; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.fiche .fm-op { margin: 0 .3em; }
.fiche .fm-answer { margin-left: .45em; font-weight: 700; font-style: italic; color: #c4161c; white-space: nowrap; }

/* En-tête commun : titre, puis Prénom / (Points, Note) / Date */
.fiche .fm-title { text-align: center; text-wrap: balance; }
/* Les lignes à remplir s'adaptent à la largeur disponible ; les libellés ne sont jamais coupés. */
.fiche .fm-idline { display: flex; align-items: baseline; gap: 14mm; margin: 6mm 0 7mm; font-size: 11pt; font-weight: 700; }
.fiche.fiche--evaluation-mode .fm-idline { gap: 6mm; }
.fiche .fm-field { display: flex; align-items: baseline; gap: 1.5mm; min-width: 0; }
.fiche .fm-field-label { white-space: nowrap; }
.fiche .fm-fill { flex: 1; min-width: 8mm; height: 1em; border-bottom: .3mm solid currentColor; }
.fiche .fm-field.is-name { flex: 3; }
.fiche .fm-field.is-date { flex: 2; }
.fiche .fm-field.is-short { flex: 1.1; }
/* Mode Évaluation : le titre, plus long, est un peu réduit pour rester sur une ligne. */
.fiche.fiche--evaluation-mode .fm-title span { font-size: 19pt; }
.fiche--academique.fiche--evaluation-mode .fm-title span { font-size: 21pt; }
.fiche--signature.fiche--evaluation-mode .fm-title span { font-size: 22pt; }
.fiche--ludique.fiche--evaluation-mode .fm-title span { font-size: 14pt; }

/* Exercices : bandeau, colonnes (nombre et hauteur de ligne fournis par le générateur) */
.fiche .fm-exercise + .fm-exercise { margin-top: 8mm; }
.fiche .fm-ex-band { display: flex; align-items: center; margin-bottom: 4mm; font-size: 12pt; }
.fiche .fm-cols { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: 9mm; }
.fiche .fm-col + .fm-col { padding-left: 9mm; border-left: .3mm solid var(--rule, #9a9a9a); }
.fiche .fm-item { display: flex; align-items: center; min-height: var(--row); font-size: 14pt; }
.fiche .fm-n { min-width: 9mm; font-weight: 700; }

/* 1 · Classique — noir et blanc exclusivement, bandeau gris #C8C8C8 */
.fiche--classique { filter: grayscale(1); color: #1a1a1a; }
.fiche--classique .fm-title span { display: block; padding: 3.5mm 6mm; border-radius: 3mm; background: #C8C8C8; color: #2b2b2b; font-size: 22pt; font-weight: 700; letter-spacing: -.2pt; }
.fiche--classique .fm-ex-label { font-weight: 700; text-decoration: underline; text-decoration-thickness: .4mm; text-underline-offset: 1.2mm; margin-right: 2.5mm; }
.fiche--classique .fm-ex-label::after { content: "."; }
.fiche--classique .fm-answer { color: #000; }

/* 2 · Contemporain — bleu profond et turquoise, formes géométriques */
.fiche--contemporain { --navy: #0e3b5c; --blue: #1667a3; --turq: #2bb5c2; --turq-l: #dcf3f5; --rule: transparent; font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif; color: #10263a; }
.fiche--contemporain .fm-deco-top { top: 5mm; left: 5mm; right: 5mm; height: 34mm; border-radius: 3mm 3mm 0 0; background: linear-gradient(112deg, var(--turq) 0 17%, #1d93ad 17% 23%, var(--turq-l) 23% 74%, var(--blue) 74% 81%, var(--navy) 81%); clip-path: polygon(0 0, 100% 0, 100% 55%, 0 100%); opacity: .95; }
.fiche--contemporain .fm-deco-corner-tr { top: 5mm; right: 5mm; width: 20mm; height: 20mm; background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, .28) 50%); }
.fiche--contemporain .fm-deco-corner-bl { left: 5mm; bottom: 5mm; width: 46mm; height: 15mm; background: linear-gradient(90deg, var(--turq), #7ad3dc); clip-path: polygon(0 0, 0 100%, 100% 100%); }
.fiche--contemporain .fm-deco-corner-br { right: 5mm; bottom: 5mm; width: 52mm; height: 17mm; background: linear-gradient(90deg, var(--blue), var(--navy)); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.fiche--contemporain .fm-head { margin-top: 2mm; }
.fiche--contemporain .fm-title span { display: inline-block; padding: 3mm 10mm; background: #fff; color: var(--navy); font-size: 22pt; font-weight: 800; letter-spacing: -.3pt; border-radius: 4mm 12mm 4mm 12mm; box-shadow: 0 1.3mm 0 var(--navy); }
.fiche--contemporain .fm-ex-band::before { content: "❯❯"; margin-right: 1.5mm; color: var(--turq); font-size: 14pt; font-weight: 900; letter-spacing: -1.6mm; }
.fiche--contemporain .fm-ex-label { position: relative; z-index: 1; padding: 1.6mm 9mm 1.6mm 5mm; background: var(--navy); color: #fff; font-weight: 800; font-size: 13pt; clip-path: polygon(0 0, 88% 0, 100% 50%, 88% 100%, 0 100%); }
.fiche--contemporain .fm-ex-text { flex: 1; margin-left: -3mm; padding: 1.6mm 5mm 1.6mm 7mm; background: linear-gradient(90deg, var(--turq-l), rgba(220, 243, 245, .25)); }
.fiche--contemporain .fm-col + .fm-col { border-left: 0; padding-left: 0; }
.fiche--contemporain .fm-item { min-height: calc(var(--row) - 4mm); margin-bottom: 4mm; padding: 0 4mm 0 2.5mm; border: .35mm solid #8ad3dc; border-radius: 2.5mm; }
.fiche--contemporain .fm-n { display: grid; place-items: center; min-width: 0; width: 7.5mm; height: 7.5mm; margin-right: 3.5mm; border-radius: 1.6mm; background: #bfe8ed; color: var(--navy); font-size: 11pt; font-weight: 800; }

/* 3 · Académique — violet et mauve, typographie traditionnelle, ornements fins */
.fiche--academique { --violet: #5b2d82; --mauve: #9a7cbb; --mauve-l: #ece3f4; --rule: #bba5d2; font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif; color: #24183a; padding: 18mm 19mm 16mm; }
.fiche--academique .fm-deco-frame { inset: 8mm; border: .5mm solid var(--violet); border-radius: 1.5mm; box-shadow: inset 0 0 0 1.2mm #fff, inset 0 0 0 1.45mm var(--mauve); }
.fiche--academique [class*="fm-deco-corner"] { width: 6mm; height: 6mm; border: .45mm solid var(--violet); border-radius: 50%; background: #fff; }
.fiche--academique .fm-deco-corner-tl { top: 5mm; left: 5mm; }
.fiche--academique .fm-deco-corner-tr { top: 5mm; right: 5mm; }
.fiche--academique .fm-deco-corner-bl { bottom: 5mm; left: 5mm; }
.fiche--academique .fm-deco-corner-br { bottom: 5mm; right: 5mm; }
.fiche--academique .fm-deco-book { top: 11mm; right: 13mm; width: 9mm; height: 7mm; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 18' fill='none' stroke='%235b2d82' stroke-width='1.3' stroke-linejoin='round'%3E%3Cpath d='M12 4C9 1.5 5 1.5 1.5 2.5v13C5 14.5 9 14.5 12 17c3-2.5 7-2.5 10.5-1.5v-13C19 1.5 15 1.5 12 4Zm0 0v13'/%3E%3C/svg%3E"); }
.fiche--academique .fm-head::before { content: ""; position: absolute; left: -6mm; top: -5mm; width: 46mm; height: 2.2mm; border-radius: 0 0 50% 0; background: linear-gradient(90deg, var(--mauve), transparent); transform: rotate(-7deg); transform-origin: left; opacity: .7; }
.fiche--academique .fm-title span { display: inline-block; padding: 3mm 8mm 3.5mm; color: #3e1e62; font-size: 25pt; font-weight: 700; letter-spacing: .1pt; border-bottom: .3mm solid var(--mauve); }
.fiche--academique .fm-idline { font-weight: 400; }
.fiche--academique .fm-ex-label { padding: 1.4mm 9mm 1.4mm 5mm; background: #6b3d96; color: #fff; font-size: 13pt; font-weight: 700; clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%); }
.fiche--academique .fm-ex-text { flex: 1; margin-left: -2mm; padding: 1.4mm 5mm 1.4mm 6mm; background: var(--mauve-l); clip-path: polygon(2.5mm 0, 100% 0, calc(100% - 2.5mm) 100%, 0 100%); }
.fiche--academique .fm-item { font-size: 14.5pt; }
.fiche--academique .fm-answer { color: #6b2fa0; }

/* 4 · Cahier de maths — bleu clair, quadrillage discret en marge, fond blanc sous les exercices */
.fiche--cahier { --ink-blue: #1d3f73; --sky: #d3e4f9; --rule: #b7cdea; font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif; color: var(--ink-blue); padding: 15mm 15mm 14mm 30mm; }
.fiche--cahier .fm-deco-grid, .fiche--cahier .fm-deco-grid-margin { background-image: linear-gradient(#e2ecf8 .25mm, transparent .25mm), linear-gradient(90deg, #e2ecf8 .25mm, transparent .25mm); background-size: 5mm 5mm; }
/* Quadrillage limité à l'en-tête (fondu vers le bas) et à la marge gauche */
.fiche--cahier .fm-deco-grid { top: 0; left: 0; right: 0; height: 75mm; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.fiche--cahier .fm-deco-grid-margin { top: 0; bottom: 0; left: 0; width: 24mm; }
.fiche--cahier .fm-deco-margin { top: 0; bottom: 0; left: 24mm; width: .45mm; background: #e06b6b; }
.fiche--cahier .fm-deco-holes { top: 18mm; bottom: 18mm; left: 7mm; width: 6mm; background: radial-gradient(circle, #fff 1.3mm, #9db5d5 1.35mm 1.75mm, transparent 1.8mm) center top / 6mm 19mm repeat-y; }
.fiche--cahier .fm-deco-pencil { right: 9mm; bottom: 8mm; width: 30mm; height: 30mm; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg stroke='%231d3f73' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M12 52 16 40 46 10l8 8-30 30Z' fill='%23f7d36b'/%3E%3Cpath d='M46 10l4-4 8 8-4 4Z' fill='%23f2a2a2'/%3E%3Cpath d='M12 52l4-12 8 8Z' fill='%23f5e4c6'/%3E%3Cpath d='M12 52l2-5 3 3Z' fill='%231d3f73'/%3E%3C/g%3E%3C/svg%3E"); opacity: .85; }
.fiche--cahier .fm-title span { display: inline-block; padding: 2.5mm 9mm; background: linear-gradient(176deg, transparent 8%, var(--sky) 8% 88%, transparent 88%); border-radius: 4mm 9mm 5mm 10mm; color: var(--ink-blue); font-size: 23pt; font-weight: 700; }
.fiche--cahier .fm-body { padding: 4mm 6mm 2mm; background: #fff; border-radius: 2mm; box-shadow: 0 0 0 .3mm #cfdff3; }
.fiche--cahier .fm-ex-label { display: inline-block; margin-right: 4mm; padding: 1.2mm 4mm; background: #fbe38a; border-radius: 1.5mm 3mm 1.5mm 3mm; font-weight: 700; font-size: 13pt; transform: rotate(-1deg); }
.fiche--cahier .fm-item { font-size: 14pt; }
.fiche--cahier .fm-answer { color: #c0392b; }

/* 5 · Signature — orange et blanc, formes angulaires, titre imposant */
.fiche--signature { --orange: #f0761b; --deep: #d9590b; --peach: #fde6d1; --rule: #e8c7aa; font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif; color: #1f1f1f; background: #fffdf9; }
.fiche--signature .fm-deco-wedge-tl { top: 5mm; left: 5mm; width: 40mm; height: 30mm; background: linear-gradient(135deg, var(--orange), #f6a25a); clip-path: polygon(0 0, 100% 0, 0 100%); }
.fiche--signature .fm-deco-wedge-tl2 { top: 5mm; left: 5mm; width: 52mm; height: 40mm; background: #2f2f2f; clip-path: polygon(78% 0, 82% 0, 0 96%, 0 90%); opacity: .85; }
.fiche--signature .fm-deco-wedge-br { right: 5mm; bottom: 5mm; width: 48mm; height: 26mm; background: linear-gradient(315deg, var(--orange), #f7a463); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.fiche--signature .fm-deco-wedge-br2 { right: 5mm; bottom: 5mm; width: 64mm; height: 36mm; background: var(--peach); clip-path: polygon(100% 18%, 100% 100%, 8% 100%); }
.fiche--signature .fm-head { margin-top: 2mm; }
.fiche--signature .fm-title span { position: relative; display: inline-block; padding: 3mm 12mm; font-size: 27pt; font-weight: 900; letter-spacing: -.6pt; color: #161616; }
.fiche--signature .fm-title span::before { content: ""; position: absolute; inset: 0; border: .55mm solid var(--orange); border-radius: 1mm; transform: skewX(-14deg); }
.fiche--signature .fm-ex-label { padding: 1.6mm 6mm; background: var(--orange); color: #fff; font-weight: 800; font-size: 13pt; border-radius: 6mm 0 0 6mm; }
.fiche--signature .fm-ex-text { flex: 1; padding: 1.6mm 5mm; background: linear-gradient(90deg, var(--peach), rgba(253, 230, 209, .3)); border-radius: 0 6mm 6mm 0; color: #a4420c; font-weight: 600; }
.fiche--signature .fm-answer { color: var(--deep); }

/* 6 · GeniMath ludique — modèle validé (sans génie ni mention GeniMath) */
.fiche--ludique { font-family: "Nunito", "Arial Rounded MT Bold", "Segoe UI", Arial, sans-serif; font-size: 12pt; border: 1.2mm solid #fff; outline: .5mm solid #c4161c; outline-offset: -6mm; padding: 13mm 14mm 11mm; }
.fiche--ludique .fm-bubble { padding: 2.5mm 4mm; border: .4mm solid #333; border-radius: 4mm; font-size: 10pt; background: #fff8f0; }
.fiche--ludique .fm-idline { justify-content: flex-start; gap: 8mm; margin: 3mm 0 0; font-size: 9.5pt; font-weight: 400; }
.fiche--ludique .fm-idline .fm-field { flex: none; }
.fiche--ludique .fm-fill { flex: none; width: 26mm; }
.fiche--ludique .fm-field.is-name .fm-fill { width: 34mm; }
.fiche--ludique .fm-field.is-short .fm-fill { width: 14mm; }
.fiche--ludique .fm-title { margin: 6mm 0 3mm; }
.fiche--ludique .fm-title span { display: inline-block; padding: 2mm 7mm; border: .5mm solid #c4161c; border-radius: 10mm; font-size: 14pt; font-weight: 800; color: #111; background: #fdeceb; }
.fiche--ludique .fm-ex-text { margin-bottom: 4mm; text-align: center; font-size: 10pt; color: #333; }
.fiche--ludique .fm-cols { column-gap: 6mm; }
.fiche--ludique .fm-col { display: grid; align-content: start; gap: 6mm; }
.fiche--ludique .fm-col + .fm-col { border-left: 0; padding-left: 0; }
.fiche--ludique .fm-item { gap: 3mm; min-height: var(--row); padding: 0 5mm; border: .4mm solid #333; border-radius: 5mm; font-size: 13pt; }
.fiche--ludique .fm-n { flex: none; min-width: 0; width: 7.5mm; height: 7.5mm; display: grid; place-items: center; border-radius: 50%; background: #111; color: #fff; font-size: 9pt; font-weight: 800; }
.fiche--ludique .fm-stars { margin-top: 9mm; display: flex; align-items: center; gap: 4mm; padding: 3mm 5mm; border: .4mm dashed #555; border-radius: 4mm; font-size: 9.5pt; }
.fiche--ludique .fm-star-row { flex: none; white-space: nowrap; font-size: 18pt; letter-spacing: 2mm; color: #c4161c; }
