:root {
  --rouge: #E5574B;
  --bleu: #2B9CC8;
  --vert: #93B83A;
  --bois: #EBD5AA;
  --police-fiche: 'Fredoka', 'Arial Rounded MT Bold', sans-serif;
}

@font-face {
  font-family: 'Fredoka';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fredoka-600.ttf') format('truetype');
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #eef0f3;
  color: #1d1d1f;
}

.controles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 16px;
  background: #fff;
}

.controles h1 { width: 100%; margin: 0; font-size: 20px; }
.correction { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
#erreur { width: 100%; margin: 0; color: var(--rouge); }
#mot { font-size: 18px; padding: 6px 10px; text-transform: uppercase; }
button { font-size: 15px; padding: 6px 12px; cursor: pointer; }

.apercu { padding: 16px; overflow: hidden; }

.fiche {
  display: grid;
  grid-template-rows: 30% 22% 48%;
  width: 297mm;
  height: 210mm;
  padding: 12mm;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
  transform-origin: top left;
}

.ligne {
  display: flex;
  align-items: center;
  justify-content: safe center;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--police-fiche);
  font-weight: 600;
  line-height: 1;
}

.ligne-majuscules { font-size: 26mm; color: #000; }

/* Lettres aimantées : un <g> par pièce (bois + lettre) ; la couleur du <g> est héritée par la lettre. */
.pieces { width: 100%; height: 100%; }
.pieces .bois { fill: var(--bois); }
.seg { cursor: pointer; pointer-events: bounding-box; }
.seg--voyelle { fill: var(--rouge); }
.seg--consonne { fill: var(--bleu); }
.seg--complexe { fill: var(--vert); }
.seg--autre { fill: #000; }

.ligne-image { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.zone-image { min-height: 0; padding: 4mm; }
.zone-image img { width: 100%; height: 100%; object-fit: contain; }
.zone-image img[hidden] { display: none; }

@page { size: A4 landscape; margin: 0; }

@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; }
  .controles { display: none !important; }
  .apercu { height: auto !important; padding: 0; overflow: visible; }
  .fiche { transform: none !important; box-shadow: none; }
}
