
.memory-game {
    display: grid;
    grid-template-columns: repeat(4, 0fr);
    gap: 16px;
}
.memory-card {
    width: 100px;
    height: 140px;
    position: relative;
    transform: scale(1);
    transform-style: preserve-3d;
    transition: transform 0.5s;
    cursor: pointer;
}

.memory-card img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    object-fit: fill;
}

.memory-card .front-face {
    transform: rotateY(180deg);
}
.memory-card.flip {
    transform: rotateY(180deg);
}

.crossword { border-collapse: collapse; margin: auto; }
.crossword td { width:25px; height:20px; border:1px solid #333; position:relative; }
.crossword td.black {border: none}
.crossword input {
    width:100%; height:100%; border:none;
    text-align:center; text-transform:uppercase; font-size:0.75rem;
}
.crossword input:focus { outline:none; background:#e0f7fa; }



#maze {
    display: grid;
    gap: 0;
    margin: 20px auto;
}
#maze .cell {
    box-sizing: border-box;
    background: #eee;
    position: relative;
    font-size: 24px;
    line-height: 40px;
    text-align: center;
}
#maze .wall    { background: #333; }
#maze .open    { background: #eee; }
#maze .visited { background: #87CEFA; }    /* lightblue */
#maze .current { background: #1E90FF; }    /* dodgerblue */


.sortable-item { cursor: move; }
.drag-handle { cursor: move; opacity: .6; margin-right: .5rem; }
.badge-val { visibility: hidden; }
.is-correct { background: #e7f7ed !important; }
.is-wrong   { background: #fde8e8 !important; }
/* Placeholder visuel quand on déplace */
.ui-sortable-placeholder {
    height: 48px; border: 2px dashed #0d6efd; background: #eef5ff !important; visibility: visible !important;
}







.zone {
    min-height: 120px; border: 2px dashed #ced4da; padding: 10px; border-radius: .75rem;
    background: #fff;
    transition: border-color .15s ease, background .15s ease;
}
.zone.dragover { border-color: #495057; background: #f8f9fa; }
.card-draggable { cursor: grab; margin: .35rem 0; }
.card-draggable:active { cursor: grabbing; }

/* Grille image cachée */
#image-container {
    width: 324px; /* 3 * (100 + 2*2px margin) */
    display: flex; flex-wrap: wrap; gap: 4px;
    margin: 20px auto;
}
.piece {
    position: relative; width: 100px; height: 100px; overflow: hidden; border-radius: .5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.piece img {
    width: 300px; height: 300px; object-fit: cover;
    /* On décale l’image dans chaque case avec des variables CSS */
    transform: translate(calc(var(--tx,0) * -100px), calc(var(--ty,0) * -100px));
    filter: saturate(1.1);
}
/* Cache sombre initial (la "grille" à retirer) */
.piece::before {
    content: ""; position: absolute; inset: 0; background: #1f2937;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
    transform: translateY(0); /* rideau fermé */
    z-index: 2;
}
/* États révélés + animations */
.piece.revealed::before {
    animation: curtain 600ms cubic-bezier(.2,.8,.2,1) forwards;
    animation-delay: var(--d, 0ms);
}
.piece.revealed img {
    opacity: 0;
    animation: pop 420ms ease-out forwards;
    animation-delay: calc(var(--d, 0ms) + 140ms);
}
@keyframes curtain {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-100%); }
}
@keyframes pop {
    0%   { transform: translate(calc(var(--tx,0) * -100px), calc(var(--ty,0) * -100px)) scale(.96) rotate(-1deg); opacity:.15; }
    60%  { transform: translate(calc(var(--tx,0) * -100px), calc(var(--ty,0) * -100px)) scale(1.02); opacity:.95; }
    100% { transform: translate(calc(var(--tx,0) * -100px), calc(var(--ty,0) * -100px)) scale(1); opacity:1; }
}
#roman-hint{
    width: 5rem;
    cursor: pointer;
}