/* Structure isolée ; palette, typographies et dimensions réglables dans theme.css. */
.tp-construction-proto-page {
    margin: 0; padding: var(--tp-cm-page-gutter); background: var(--tp-cm-site);
    color: var(--tp-cm-ink); font: var(--tp-cm-font-size)/1.5 var(--tp-cm-font);
}
.tp-construction-proto-entete, .tp-construction-proto-contenu {
    max-width: var(--tp-cm-page-width); margin: 0 auto;
}
.tp-construction-proto-entete { color: var(--tp-cm-white); padding: 4px 4px 12px; }
.tp-construction-proto-entete h1 { font: bold 1.125rem/1.4 var(--tp-cm-letter-font); margin: 0 0 4px; }
.tp-construction-proto-entete p { margin: 0; font-size: .875rem; }
.tp-construction-proto {
    background: var(--tp-cm-paper); padding: var(--tp-cm-board-padding); margin: 0 0 18px;
    border: 1px solid var(--tp-cm-soft-line); border-radius: var(--tp-cm-board-radius);
}
.tp-construction-proto *, .tp-construction-proto-recette * { box-sizing: border-box; }
.tp-construction-proto [hidden] { display: none !important; }
.tp-construction-proto h2 { font: bold var(--tp-cm-title-size)/1.3 var(--tp-cm-letter-font); margin: 0; color: var(--tp-cm-blue-dark); }
.tp-construction-proto h3 { font-size: 1.125rem; margin: 0 0 8px; }
.tp-construction-proto-barre {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
    gap: 12px 20px; padding-bottom: 16px; border-bottom: 1px solid var(--tp-cm-soft-line);
}
.tp-construction-proto button, .tp-construction-proto-recette button {
    min-width: 48px; min-height: 48px; min-height: max(48px, var(--tp-cm-control-height));
    padding: 10px 16px; background: var(--tp-cm-white); border: 2px solid var(--tp-cm-line);
    border-radius: var(--tp-cm-radius); color: var(--tp-cm-ink); font: inherit; cursor: pointer;
    overflow-wrap: anywhere;
}
.tp-construction-proto button:hover { background: var(--tp-cm-neutral); }
.tp-construction-proto button:disabled {
    color: var(--tp-cm-muted); border-color: var(--tp-cm-line); border-style: dashed;
    cursor: default; background: var(--tp-cm-neutral);
}
.tp-construction-proto :focus-visible, .tp-construction-proto-recette :focus-visible {
    outline: 3px solid var(--tp-cm-focus); outline-offset: 4px;
}
.tp-construction-proto-mode { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-construction-proto-mode button { color: var(--tp-cm-blue-dark); border-color: var(--tp-cm-blue); font-weight: bold; }
.tp-construction-proto [data-vue="jeu"], .tp-construction-proto [data-vue="navigation"],
.tp-construction-proto-aide { max-width: var(--tp-cm-play-width); margin-left: auto; margin-right: auto; }
.tp-construction-proto figure { text-align: center; margin: 18px 0 14px; }
.tp-construction-proto-illustration {
    display: flex; align-items: center; justify-content: center;
    width: fit-content; max-width: 100%; min-width: var(--tp-cm-image-size);
    min-height: var(--tp-cm-image-size); margin: 0 auto; padding: 8px;
    background: var(--tp-cm-white); border: 1px solid var(--tp-cm-soft-line); border-radius: var(--tp-cm-board-radius);
}
.tp-construction-proto figure canvas, .tp-construction-proto figure img {
    display: block; width: var(--tp-cm-image-size); height: var(--tp-cm-image-size); max-width: 100%; object-fit: contain;
}
.tp-construction-proto figcaption { margin-top: 8px; color: var(--tp-cm-muted); }
.tp-construction-proto [data-vue="consigne"] { text-align: center; margin: 0 auto 14px; max-width: 42em; }
.tp-construction-proto-cases, .tp-construction-proto-reserve {
    display: flex; justify-content: center; flex-wrap: wrap; gap: var(--tp-cm-tile-gap);
}
.tp-construction-proto-cases { padding: 8px 0; }
.tp-construction-proto .tp-construction-proto-case, .tp-construction-proto-reserve button {
    display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center;
    width: var(--tp-cm-tile-width); height: var(--tp-cm-tile-height); min-height: 48px;
    font: bold var(--tp-cm-letter-size)/1.35 var(--tp-cm-letter-font); padding: 4px;
    user-select: none; touch-action: none;
}
.tp-construction-proto .tp-construction-proto-case {
    border: 2px solid var(--tp-cm-turquoise-line); border-bottom-width: 4px; border-radius: var(--tp-cm-radius);
    color: var(--tp-cm-turquoise); background: var(--tp-cm-turquoise-soft);
}
.tp-construction-proto button.tp-construction-proto-case:hover:not(:disabled) { background: var(--tp-cm-white); }
.tp-construction-proto [data-vue="reserve-zone"] {
    margin: 16px auto 20px; padding: 12px 12px 16px; border-radius: var(--tp-cm-radius); background: var(--tp-cm-white);
}
.tp-construction-proto [data-vue="reserve-zone"] > p { text-align: center; font-size: .9375rem; margin: 0 0 12px; color: var(--tp-cm-muted); }
.tp-construction-proto-reserve button { background: var(--tp-cm-blue-soft); color: var(--tp-cm-blue-dark); border-color: var(--tp-cm-blue); border-bottom-width: 4px; }
.tp-construction-proto-reserve button:hover:not(:disabled) { background: var(--tp-cm-white); }
.tp-construction-proto-reserve button[aria-pressed="true"] {
    color: var(--tp-cm-white); background: var(--tp-cm-blue); border-color: var(--tp-cm-blue-dark);
    box-shadow: 0 0 0 2px var(--tp-cm-white), 0 0 0 4px var(--tp-cm-blue); text-decoration: underline; text-underline-offset: 4px;
}
.tp-construction-proto-reserve button[aria-pressed="true"]:hover { background: var(--tp-cm-blue-dark); }
.tp-construction-proto .tp-construction-proto-glisse { outline: 3px dashed var(--tp-cm-focus); outline-offset: 4px; }
.tp-construction-proto .tp-construction-proto-cible { --tp-rv-ombre-complementaire: inset 0 0 0 4px var(--tp-cm-turquoise); box-shadow: var(--tp-rv-ombre-complementaire); }
.tp-construction-proto .tp-construction-proto-revelee { border-bottom: 6px double var(--tp-cm-amber); }
.tp-construction-proto [data-vue="saisie-zone"] { margin: 16px auto 20px; text-align: center; }
.tp-construction-proto label { display: block; margin-bottom: 8px; }
.tp-construction-proto input {
    width: min(100%, 360px); min-height: 60px; font: bold 1.875rem/1.5 var(--tp-cm-letter-font); padding: 8px 12px;
    color: var(--tp-cm-blue-dark); background: var(--tp-cm-white); border: 2px solid var(--tp-cm-blue); border-radius: var(--tp-cm-radius);
}
.tp-construction-proto-note { color: var(--tp-cm-muted); font-size: .9375rem; margin: 8px 0; }
.tp-construction-proto-commandes { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; }
.tp-construction-proto [data-action="verifier"] { font-weight: bold; background: var(--tp-cm-blue); color: var(--tp-cm-white); border-color: var(--tp-cm-blue); min-width: 140px; }
.tp-construction-proto [data-action="verifier"]:hover { background: var(--tp-cm-blue-dark); border-color: var(--tp-cm-blue-dark); }
.tp-construction-proto[data-proto-valide="oui"] [data-action="verifier"] { background: var(--tp-cm-white); color: var(--tp-cm-blue-dark); }
.tp-construction-proto [data-action="aide"], .tp-construction-proto [data-action="reveler"] { color: var(--tp-cm-amber); border-color: var(--tp-cm-amber); background: var(--tp-cm-amber-soft); }
.tp-construction-proto [data-action="aide"]:hover, .tp-construction-proto [data-action="reveler"]:hover:not(:disabled) { background: var(--tp-cm-white); }
.tp-construction-proto [data-action="reveler"]:disabled { color: var(--tp-cm-muted); border-color: var(--tp-cm-line); background: var(--tp-cm-neutral); }
.tp-construction-proto-aide { text-align: left; margin-bottom: 16px; border: 1px solid var(--tp-cm-amber); border-radius: var(--tp-cm-radius); background: var(--tp-cm-amber-soft); color: var(--tp-cm-amber); padding: 16px; margin-top: 16px; }
.tp-construction-proto-aide p { margin: 8px 0; }
.tp-construction-proto-message { min-height: 3em; font-weight: bold; margin: 12px 0; padding: 12px 16px; border-left: 5px solid var(--tp-cm-line); border-radius: 8px; background: var(--tp-cm-neutral); text-align: left; }
.tp-construction-proto-message[data-retour="reussite"] { color: var(--tp-cm-green); background: var(--tp-cm-green-soft); border-color: var(--tp-cm-green); }
.tp-construction-proto-message[data-retour="erreur"] { color: var(--tp-cm-red); background: var(--tp-cm-red-soft); border-color: var(--tp-cm-red); }
.tp-construction-proto [data-vue="progression"] { font-size: .9375rem; color: var(--tp-cm-muted); margin: 8px 0 12px; }
.tp-construction-proto [data-vue="fin"] { font-weight: bold; color: var(--tp-cm-green); margin: 8px 0; }
.tp-construction-proto .tp-construction-proto-principal {
    display: block; width: min(100%, 420px); margin: 0 auto; min-height: max(56px, var(--tp-cm-next-height));
    font-weight: bold; background: var(--tp-cm-green); color: var(--tp-cm-white); border-color: var(--tp-cm-green-dark);
}
.tp-construction-proto .tp-construction-proto-principal:hover:not(:disabled) { background: var(--tp-cm-green-dark); }
.tp-construction-proto [data-vue="navigation"] { text-align: center; }
.tp-construction-proto dialog {
    width: min(calc(100vw - 32px), 520px); max-height: 90vh; overflow-y: auto; padding: 24px;
    border: 2px solid var(--tp-cm-blue); border-radius: var(--tp-cm-board-radius); background: var(--tp-cm-paper); color: var(--tp-cm-ink);
}
.tp-construction-proto dialog::backdrop { background: var(--tp-cm-backdrop); }
.tp-construction-proto dialog button { margin: 8px 4px 0 0; }
.tp-construction-proto [data-action="annuler-mode"] { font-weight: bold; }
.tp-construction-proto-annonce { margin: 170px 0; padding: 24px; text-align: center; border: 2px dashed var(--tp-cm-line); background: var(--tp-cm-neutral); }
.tp-construction-proto-recette { background: var(--tp-cm-white); padding: 20px; border-radius: var(--tp-cm-radius); }
.tp-construction-proto-recette pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.tp-construction-proto-icone-lettres { display: inline-flex; gap: 2px; vertical-align: middle; }
.tp-construction-proto-icone-lettres span { display: inline-block; padding: 0 3px; border: 1px solid currentColor; border-radius: 2px; font-size: .75em; line-height: 1.25; }
@media (max-width: 600px) {
    .tp-construction-proto-barre { justify-content: center; text-align: center; gap: 10px; }
    .tp-construction-proto-barre h2 { flex-basis: 100%; }
    .tp-construction-proto-commandes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
    .tp-construction-proto-commandes [data-action="recommencer"] { grid-column: 1; grid-row: 1; }
    .tp-construction-proto-commandes [data-action="verifier"] { grid-column: 2; grid-row: 1; min-width: 0; }
    .tp-construction-proto-commandes [data-action="aide"] { grid-column: 1 / -1; justify-self: center; min-width: 120px; }
    .tp-construction-proto-commandes button { padding: 10px 8px; }
}
@media (max-width: 480px) {
    .tp-construction-proto figure { margin: 14px 0 10px; }
    .tp-construction-proto [data-vue="reserve-zone"] { padding: 10px 8px 12px; margin: 12px 0; }
    .tp-construction-proto [data-vue="consigne"] { font-size: 1rem; margin-bottom: 10px; }
    .tp-construction-proto-message { padding: 10px 12px; }
    .tp-construction-proto dialog { padding: 18px; }
}

/* Sur les écrans les plus étroits, conserver les libellés entiers. */
@media (max-width: 360px) {
    .tp-construction-proto-commandes { grid-template-columns: minmax(0, 1fr); }
    .tp-construction-proto-commandes [data-action="verifier"] { grid-column: 1; grid-row: 2; }
    .tp-construction-proto-commandes [data-action="aide"] { grid-row: 3; }
}

/* Seul le composant chargé ici utilise ces variables ; aucun effet sur les autres jeux. */
.tp-construction-proto { --tp-rv-couleur: var(--tp-cm-red); --tp-rv-epaisseur: var(--tp-cm-retour-epaisseur); }
.tp-construction-proto-accessible {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
