/* =====================================================================
   /maths/numeration/nombres_decimaux/lire_ecrire_decomposer_decimaux/fiches/fiches.css
   ===================================================================== */

.dec-fiches .dec-fiches-panel {
    position: sticky;
    top: 1rem;
}

.dec-fiches-preview-viewport {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1rem;
}

/* ---------------------------------------------------------------------
   Feuille A4 portrait réelle
   --------------------------------------------------------------------- */

.dec-fiches-sheet {
    width: 210mm;
    min-width: 210mm;
    height: 297mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 7mm 9mm 8mm;
    box-sizing: border-box;
    position: relative;

    background: #fff;
    border: 1px solid #d6dbe3;
    border-radius: .4rem;
    box-shadow: 0 .2rem .8rem rgba(0,0,0,.06);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 8.8pt;
    line-height: 1.14;
}

/* Aucun rognage : si le contenu dépasse 297 mm, il reste visible. */
.dec-fiches-sheet {
    overflow: visible;
}

/* ---------------------------------------------------------------------
   En-tête
   --------------------------------------------------------------------- */

.dec-sheet-header {
    display: grid;
    grid-template-columns: 19mm 1fr 19mm;
    align-items: center;
    min-height: 17mm;
    margin-bottom: 2.5mm;
}

.dec-sheet-logo {
    font-weight: 800;
    font-size: 8pt;
    text-align: center;
}

.dec-sheet-title {
    text-align: center;
    font-size: 16pt;
    font-weight: 800;
    line-height: 1.08;
}

.dec-sheet-subtitle {
    margin-top: .7mm;
    color: #6c757d;
    font-size: 8.4pt;
    font-weight: 500;
}

/* ---------------------------------------------------------------------
   Exercices
   --------------------------------------------------------------------- */

.dec-block {
    border: 1px solid #ced4da;
    border-radius: 2mm;
    margin-bottom: 2.6mm;
    padding: 2mm 2mm;
    box-sizing: border-box;
}

.dec-block--measure {
    margin-bottom: 0;
}

.dec-block-heading {
    margin: 0 0 .9mm;
    font-size: 9.7pt;
    line-height: 1.08;
    font-weight: 800;
}

.dec-block-heading .instruction-inline {
    color: #5b6470;
    font-size: 7.7pt;
    font-weight: 500;
}

.dec-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 4mm;
    row-gap: .9mm;
}

.dec-item {
    min-width: 0;
    font-size: 8.8pt;
    line-height: 1.14;
}

.dec-answer {
    display: inline-block;
    min-width: 24mm;
    min-height: 3.2mm;
    padding: 0 .8mm;
    border-bottom: .3mm dotted #67717d;
    vertical-align: baseline;
    font-weight: 700;
}

.dec-fiches-sheet.is-student .dec-answer {
    color: transparent;
}

.dec-fiches-sheet.is-correction .dec-answer {
    color: #198754;
}

/* Exercice 1 : une question par ligne */
.dec-block--value .dec-items {
    grid-template-columns: 1fr;
    row-gap: 1mm;
}

/* Exercice 2 : une question par ligne */
.dec-block--read .dec-items {
    grid-template-columns: 1fr;
    row-gap: 1mm;
}

/* Exercice 3 : = ou ≠ */
.dec-item--relation {
    white-space: nowrap;
}

.dec-relation-answer {
    min-width: 8mm;
    margin: 0 1.5mm;
    text-align: center;
}

.dec-fiches-sheet.is-correction .dec-relation-answer {
    color: #198754;
    font-size: 11pt;
    font-weight: 800;
}

/* Exercice 4 : suppression des zéros inutiles */
.dec-block--trimzero .dec-answer {
    min-width: 24mm;
}

/* Exercice 5 : une question par ligne + réponse sous l'énoncé */
.dec-block--decomp .dec-items {
    grid-template-columns: 1fr;
    row-gap: 1.2mm;
}

.dec-item--long-answer .dec-answer--block {
    display: block;
    width: calc(100% - 12mm);
    min-height: 3.2mm;
    margin: .45mm 0 0 3mm;
}

/* Correction de l'exercice 1 : nombre complet, chiffre ciblé en vert */
.dec-fiches-sheet.is-correction .dec-answer--full-number {
    color: inherit;
    font-weight: 400;
}

.dec-fiches-sheet.is-correction .dec-answer--full-number .dec-target-digit {
    color: #198754;
    font-weight: 800;
}

/* ---------------------------------------------------------------------
   Pied de page : même logique que le PDF, mais légèrement remonté.
   --------------------------------------------------------------------- */

.dec-sheet-footer {
    position: absolute;
    left: 9mm;
    right: 9mm;
    bottom: 6mm;

    display: flex;
    justify-content: space-between;
    gap: 1rem;

    color: #6c757d;
    font-size: 7.2pt;
    line-height: 1;
}

.dec-sheet-footer .student-fields {
    min-width: 55%;
}

.dec-fiches .card-header .btn-group .btn.active {
    font-weight: 700;
}

@media (max-width: 900px) {
    .dec-fiches-preview-viewport {
        overflow-x: auto;
    }

    .dec-fiches .dec-fiches-panel {
        position: static;
    }
}


/* ---------------------------------------------------------------------
   V9 - Calibration visuelle de l'aperçu sur le rendu Dompdf validé.
   Les hauteurs sont minimales, jamais rognées.
   --------------------------------------------------------------------- */

.dec-block--value {
    min-height: 39mm;
}

.dec-block--read {
    min-height: 40mm;
}

.dec-block--zero {
    min-height: 31mm;
}

.dec-block--trimzero {
    min-height: 27mm;
}

.dec-block--decomp {
    min-height: 66mm;
}

.dec-block--measure {
    min-height: 33mm;
}

/* Les items restent répartis naturellement dans chaque bloc. */
.dec-block--value .dec-items,
.dec-block--read .dec-items,
.dec-block--decomp .dec-items {
    align-content: start;
}

/* Un peu plus de respiration entre les lignes, comme dans Dompdf. */
.dec-block--value .dec-item,
.dec-block--read .dec-item {
    padding-top: .45mm;
    padding-bottom: .45mm;
}

.dec-block--zero .dec-item,
.dec-block--trimzero .dec-item,
.dec-block--measure .dec-item {
    padding-top: .35mm;
    padding-bottom: .35mm;
}

.dec-block--decomp .dec-item {
    padding-top: .55mm;
    padding-bottom: .55mm;
}
