/* ===== Dévoile le dragon : palette du site =====
   Turquoise : 85ECE4 · 55E0D6 · 30D5C9 · 0CC9BB · 00A094
   Bleu      : 91B0EE · 6590E4 · 4275DB · 205BD0 · 0C42AC
   Vert      : 95F68B · 6AF05C · 46EB35 · 22E50E · 14D200
*/
:root {
    --tq1: #85ECE4; --tq2: #55E0D6; --tq3: #30D5C9; --tq4: #0CC9BB; --tq5: #00A094;
    --bl1: #91B0EE; --bl2: #6590E4; --bl3: #4275DB; --bl4: #205BD0; --bl5: #0C42AC;
    --vt1: #95F68B; --vt2: #6AF05C; --vt3: #46EB35; --vt4: #22E50E; --vt5: #14D200;
    --rouge1: #F58A6B; --rouge2: #D9553A; --rouge3: #A83A25;
    /* couleurs utilisées par le pied de page (legal.css) */
    --colorBackLogo: rgb(149, 246, 139);
    --colorTextP: rgb(12, 66, 172);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Roboto", Arial, sans-serif;
}
[hidden] { display: none !important; }

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;            /* colonne : le pied de page reste en bas de l'écran */
    flex-direction: column;
    background-color: var(--bl1);
}

.jeuDD {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.titreDD {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    color: var(--bl5);
    text-shadow: 0 2px 0 var(--tq1);
}

/* ----- Cartes (écran de choix) ----- */
.carteDD {
    width: 100%;
    max-width: 620px;
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
    background-image:
        linear-gradient(160deg, var(--tq1), var(--tq2)),
        linear-gradient(135deg, var(--bl4), var(--vt3));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border: 4px solid transparent;
    border-radius: 28px;
    box-shadow: 0 10px 30px rgba(12, 66, 172, 0.35);
}
.consigneDD {
    font-size: 1.2rem;
    color: var(--bl5);
}

.tablesDD {
    width: 100%;
    border: none;
}
.tablesDD legend {
    width: 100%;
    margin-bottom: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    color: var(--bl5);
}
.puces {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.puce {
    position: relative;
    cursor: pointer;
}
.puce input {
    position: absolute;
    opacity: 0;
    inset: 0;
    cursor: pointer;
}
.puce span {
    display: block;
    padding: 10px 16px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bl5);
    background-color: rgba(255, 255, 255, 0.7);
    border: 3px solid var(--bl3);
    border-radius: 30px;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.puce input:checked + span {
    color: #fff;
    background: linear-gradient(135deg, var(--bl4), var(--bl3));
    border-color: var(--bl5);
}
.puce input:focus-visible + span {
    outline: 4px solid var(--vt4);
    outline-offset: 2px;
}
.raccourcis {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.erreurChoix {
    min-height: 1.4em;
    font-weight: 700;
    color: var(--rouge3);
}

/* ----- Boutons ----- */
.boutonDD {
    display: inline-block;
    padding: 12px 34px;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--bl4), var(--bl3));
    border: none;
    border-radius: 34px;
    cursor: pointer;
    box-shadow: 0 5px 0 var(--bl5);
    transition: transform 0.15s, box-shadow 0.15s, background 0.3s;
}
.boutonDD:hover {
    background: linear-gradient(135deg, var(--vt5), var(--vt3));
    color: var(--bl5);
    box-shadow: 0 5px 0 var(--tq5);
}
.boutonDD:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--tq5);
}
.boutonDD:focus-visible,
.lienDD:focus-visible,
.tuile:focus-visible {
    outline: 4px solid var(--vt4);
    outline-offset: 3px;
}
.boutonDD.secondaire {
    background: linear-gradient(135deg, var(--tq5), var(--tq4));
    box-shadow: 0 5px 0 var(--bl5);
}
.lienDD {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bl5);
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
}

/* ----- Écran de jeu ----- */
#ecranJeu {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.infosDD {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 16px;
    padding: 8px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bl5);
    background-color: rgba(255, 255, 255, 0.55);
    border: 3px solid var(--tq3);
    border-radius: 30px;
}

/* Le plateau garde les proportions du dessin et tient dans la hauteur de l'écran */
.plateau {
    --bord: 5px;
    --ratio: 1.4;           /* remplacé par le script selon le dessin tiré */
    width: 100%;
    max-width: max(320px, min(100%, calc((100vh - 360px) * var(--ratio))));
    aspect-ratio: var(--ratio);
    container-type: inline-size;
    background-color: #fff;
    border: var(--bord) solid var(--bl4);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(12, 66, 172, 0.4);
    transition: box-shadow 0.6s, border-color 0.6s;
}
.plateau.complet {
    border-color: var(--vt4);
    box-shadow: 0 0 0 6px rgba(70, 235, 53, 0.45), 0 10px 30px rgba(12, 66, 172, 0.4);
}
.tuiles {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(var(--cols), 1fr);
    grid-template-rows: repeat(var(--rows), 1fr);
}

/* Une tuile = sa part du dessin, recouverte d'un couvercle qui disparaît quand la réponse est juste */
.tuile {
    position: relative;
    padding: 0;
    border: none;
    cursor: pointer;
    background-color: #fff;
    background-image: var(--image);
    background-repeat: no-repeat;
    background-size: calc(var(--cols) * 100%) calc(var(--rows) * 100%);
    background-position: var(--px) var(--py);
}
.couvercle {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.65);
    transition: opacity 0.5s, transform 0.5s, filter 0.2s, visibility 0s 0.5s;
}
.teinteA .couvercle { background: linear-gradient(145deg, var(--tq2), var(--tq5)); }
.teinteB .couvercle { background: linear-gradient(145deg, var(--bl2), var(--bl4)); }
.libelle {
    font-size: clamp(0.75rem, 3.2cqw, 2rem);
    font-weight: 900;
    white-space: nowrap;
    color: #fff;
    text-shadow: 0 2px 3px rgba(12, 66, 172, 0.6);
}
.tuile:not(:disabled):hover .couvercle {
    filter: brightness(1.15);
    transform: scale(1.04);
}
.tuile.choisie .couvercle {
    outline: 5px solid var(--vt3);
    outline-offset: -5px;
    filter: brightness(1.2);
}
.tuile.verrou { cursor: not-allowed; }
.tuile.verrou .couvercle { background: linear-gradient(145deg, var(--rouge1), var(--rouge2)); }
.tuile.revient .couvercle { animation: revient 0.5s ease-in-out 3; }
.tuile.revelee { cursor: default; }
.tuile.revelee .couvercle {
    opacity: 0;
    transform: scale(0.5);
    visibility: hidden;
    pointer-events: none;
}
@keyframes revient {
    50% { transform: scale(1.12); filter: brightness(1.3); }
}

/* ----- Panneau de réponse ----- */
.panneauDD {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
#messageDD {
    width: 100%;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    color: var(--bl5);
    background-color: rgba(255, 255, 255, 0.55);
    border: 3px dashed var(--tq5);
    border-radius: 24px;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
#messageDD.ok {
    background-color: var(--vt1);
    border: 3px solid var(--vt5);
}
#messageDD.ko {
    color: #fff;
    background-color: var(--rouge2);
    border: 3px solid var(--rouge3);
}
.formDD {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}
.questionDD {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--bl5);
}
#reponseDD {
    width: 130px;
    height: 64px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--bl5);
    background-color: #fff;
    border: 4px solid var(--bl3);
    border-radius: 32px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}
#reponseDD:focus {
    border-color: var(--vt4);
    box-shadow: 0 0 0 6px rgba(70, 235, 53, 0.35);
}
.finDD {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

@media (max-width: 520px) {
    .jeuDD { padding: 12px; }
    .carteDD { padding: 20px 14px; }
    .questionDD { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
    .couvercle, .plateau, .boutonDD { transition: none; }
    .tuile.revient .couvercle { animation: none; }
}
