/*
 * FUTFUT CLUB : Snake de conjugaison.
 * Même mise en page que les labyrinthes (Additions, Géométrie) :
 * le jeu à gauche, la bulle et le personnage à droite,
 * les flèches sous le plateau.
 */

.peeksee-snake-game {
    --snake-primary: #7c4dff;
    --snake-green: #42c879;
    --snake-red: #ff6b6b;
    --snake-wall-start: #a452f6;
    --snake-wall-end: #6f42e8;
    --snake-path: #fffdf7;
    --snake-path-alt: #fbf6ec;
    --snake-border: #ebe4ff;
    --snake-body: #5fd06f;
    --snake-body-dark: #2a8a45;

    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    font-family: inherit;
}

.peeksee-snake-game,
.peeksee-snake-game * {
    box-sizing: border-box;
}

.peeksee-snake-game .peeksee-snake-is-hidden,
.futfut-results-next-button.peeksee-snake-is-hidden {
    display: none !important;
}


/* Structure générale */

.peeksee-snake-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 440px;
    gap: 28px;
    align-items: center;
}

.peeksee-snake-card {
    min-width: 0;
    padding: 24px;
    background: #ffffff;
    border: 3px solid var(--snake-border);
    border-radius: 28px;
    box-shadow: 0 14px 34px rgba(70, 48, 130, 0.12);
}

.peeksee-snake-current-level {
    margin: 0 0 10px;
    color: #4a367f;
    font-family: "Fredoka Bold", Fredoka, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.25;
    text-align: center;
}


/* Progression et cœurs */

.peeksee-snake-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 18px;
    margin-bottom: 14px;
}

.peeksee-snake-progress {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.peeksee-snake-progress-dot {
    width: 16px;
    height: 16px;
    background: #e8defd;
    border: 3px solid #d8c8ff;
    border-radius: 50%;
}

.peeksee-snake-progress-dot.is-current {
    border-color: var(--snake-primary);
    box-shadow: 0 0 0 3px #e3d6ff;
}

.peeksee-snake-progress-dot.is-correct {
    background: var(--snake-green);
    border-color: var(--snake-green);
}

.peeksee-snake-progress-dot.is-wrong {
    background: var(--snake-red);
    border-color: var(--snake-red);
}

.peeksee-snake-hearts {
    display: flex;
    gap: 2px;
    padding: 3px 10px;
    font-size: 18px;
    line-height: 1.2;
    background: #f8f3ff;
    border: 2px solid #eee6ff;
    border-radius: 999px;
}

.peeksee-snake-game.is-bumped .peeksee-snake-hearts {
    animation: peeksee-snake-shake 0.35s ease;
}


/* Consigne : pronom + verbe + temps */

.peeksee-snake-consigne {
    display: flex;
    justify-content: center;
    gap: 8px;
    max-width: 620px;
    margin: 0 auto 12px;
    padding: 10px;
    background: #f8f3ff;
    border: 3px solid #efe6ff;
    border-radius: 22px;
}

.peeksee-snake-box {
    flex: 1;
    max-width: 180px;
    min-width: 0;
    padding: 6px 8px 8px;
    text-align: center;
    border-radius: 18px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

.peeksee-snake-box small {
    display: block;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.85;
}

.peeksee-snake-box strong {
    display: block;
    font-family: "Fredoka Bold", Fredoka, Arial, sans-serif;
    font-size: 26px;
    font-weight: normal;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.peeksee-snake-box em {
    display: block;
    font-size: 12px;
    font-style: normal;
    opacity: 0.9;
}

.peeksee-snake-box.is-pronoun {
    color: #5710b8;
    background: #f1e9ff;
}

.peeksee-snake-box.is-verb {
    color: #b55d00;
    background: #fff1dc;
}

.peeksee-snake-box.is-tense {
    color: #ffffff;
    background: #8a5cf6;
}

/* Une couleur par temps, toujours la même */
.peeksee-snake-box.is-present { background: #2fb36a; }
.peeksee-snake-box.is-futur { background: #3d8bff; }
.peeksee-snake-box.is-imparfait { background: #f2a516; }
.peeksee-snake-box.is-passe-compose { background: #e0559b; }
.peeksee-snake-box.is-passe-simple { background: #8a5cf6; }


/* Plateau */

.peeksee-snake-board-wrap {
    position: relative;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f8f3ff;
    border: 4px solid #eadfff;
    border-radius: 22px;
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

.peeksee-snake-game.is-moving .peeksee-snake-board-wrap {
    touch-action: none;
}

.peeksee-snake-game.is-bumped .peeksee-snake-board-wrap {
    animation: peeksee-snake-shake 0.35s ease;
}

.peeksee-snake-board {
    display: grid;
    width: 100%;
    height: 100%;
}

.peeksee-snake-cell {
    min-width: 0;
    min-height: 0;
    background: var(--snake-path);
}

.peeksee-snake-cell.is-alt {
    background: var(--snake-path-alt);
}

.peeksee-snake-cell.is-wall {
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.26), transparent 27%),
        linear-gradient(135deg, var(--snake-wall-start), var(--snake-wall-end));
}


/* Serpent : un tube vert tout simple, la petite tête devant */

.peeksee-snake-body {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.peeksee-snake-body path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.peeksee-snake-body-outline {
    stroke: var(--snake-body-dark);
    stroke-width: 0.8;
}

.peeksee-snake-body-fill {
    stroke: var(--snake-body);
    stroke-width: 0.64;
}

.peeksee-snake-head {
    position: absolute;
    z-index: 5;
    pointer-events: none;
}

.peeksee-snake-head img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.2));
}


/* Pommes avec la réponse écrite dessous */

.peeksee-snake-apples {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.peeksee-snake-apple {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.peeksee-snake-apple svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 3px 2px rgba(80, 0, 0, 0.25));
}

.peeksee-snake-apple span {
    margin-top: -18%;
    padding: 1px 8px;
    color: #3c2a71;
    font-family: "Fredoka Bold", Fredoka, Arial, sans-serif;
    font-size: clamp(11px, 2.4vw, 18px);
    line-height: 1.2;
    white-space: nowrap;
    background: #ffffff;
    border: 3px solid #ffb3b3;
    border-radius: 999px;
    box-shadow: 0 3px 0 #ffb3b3;
}

.peeksee-snake-apple.is-correct span {
    color: #1f7a42;
    background: #eafff2;
    border-color: var(--snake-green);
    box-shadow: 0 3px 0 var(--snake-green);
}

.peeksee-snake-apple.is-correct {
    transform: translateX(-50%) scale(1.12);
}

.peeksee-snake-apple.is-wrong span {
    color: #b43a3a;
    background: #fff0f0;
    border-color: var(--snake-red);
    box-shadow: 0 3px 0 var(--snake-red);
    text-decoration: line-through;
}

.peeksee-snake-apple.is-eaten svg {
    opacity: 0;
}

.peeksee-snake-apple.is-faded {
    opacity: 0.25;
}


/* Petit message « Appuie sur une flèche », sous le plateau */

.peeksee-snake-hint {
    max-width: 620px;
    margin: 10px auto 0;
    color: #5710b8;
    font-family: "Fredoka Bold", Fredoka, Arial, sans-serif;
    font-size: 16px;
    text-align: center;
    visibility: hidden;
}

.peeksee-snake-hint.is-visible {
    visibility: visible;
    animation: peeksee-snake-blink 1.4s ease-in-out infinite;
}


/* Flèches sous le plateau (comme les labyrinthes) */

.peeksee-snake-controls {
    display: grid;
    grid-template-columns: 54px 54px 54px;
    grid-template-rows: 54px 54px 54px;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.peeksee-snake-control-btn {
    margin: 0;
    padding: 0;
    color: #4a367f;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    background: #efe7ff;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 4px 0 #d8c8ff;
    touch-action: manipulation;
}

.peeksee-snake-control-btn:hover,
.peeksee-snake-control-btn:focus {
    color: #4a367f;
    background: #e6dbff;
}

.peeksee-snake-control-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #d8c8ff;
}

.peeksee-snake-control-btn.up { grid-column: 2; grid-row: 1; }
.peeksee-snake-control-btn.left { grid-column: 1; grid-row: 2; }
.peeksee-snake-control-btn.right { grid-column: 3; grid-row: 2; }
.peeksee-snake-control-btn.down { grid-column: 2; grid-row: 3; }


/* Récapitulatif */

.peeksee-snake-results-panel {
    display: none;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
}

.peeksee-snake-results-panel.is-visible {
    display: block;
}


/* Personnage et bulle */

.peeksee-snake-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding-bottom: 14px;
}

.peeksee-snake-panda-large {
    width: 420px;
    max-width: 100%;
    filter: drop-shadow(0 10px 10px rgba(48, 30, 85, 0.16));
}

.peeksee-snake-panda-large img {
    display: block;
    width: 100%;
    height: auto;
}

.peeksee-snake-message {
    position: relative;
    width: 100%;
    padding: 16px 18px;
    color: #3c2a71;
    font-family: "Fredoka Bold", Fredoka, Arial, sans-serif;
    text-align: center;
    background: #ffffff;
    border: 3px solid #eadfff;
    border-radius: 22px;
    box-shadow: 0 8px 20px rgba(70, 48, 130, 0.1);
}

.peeksee-snake-message::after {
    content: "";
    position: absolute;
    right: 48px;
    bottom: -14px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-right: 3px solid #eadfff;
    border-bottom: 3px solid #eadfff;
    transform: rotate(45deg);
}


/* Bouton Recommencer simple et plat */

.peeksee-snake-button.secondary {
    min-height: 42px;
    padding: 9px 18px;
    color: #4a367f;
    font: inherit;
    font-family: "Fredoka Bold", Fredoka, Arial, sans-serif;
    font-size: 16px;
    cursor: pointer;
    background: #f1eaff;
    border: 2px solid #d9caff;
    border-radius: 12px;
    box-shadow: none;
}

.peeksee-snake-button.secondary:hover,
.peeksee-snake-button.secondary:focus-visible {
    color: #4a367f;
    background: #e9ddff;
}

.peeksee-snake-restart-outside {
    display: flex;
    justify-content: center;
    width: 100%;
}

.peeksee-snake-restart-mobile {
    display: none;
}

.peeksee-snake-scroll-anchor {
    position: relative;
    width: 100%;
    height: 0;
    pointer-events: none;
}

.peeksee-snake-scroll-anchor-mobile {
    display: none;
}


/* Animations */

@keyframes peeksee-snake-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes peeksee-snake-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
    .peeksee-snake-hint.is-visible,
    .peeksee-snake-game.is-bumped .peeksee-snake-board-wrap,
    .peeksee-snake-game.is-bumped .peeksee-snake-hearts {
        animation: none;
    }
}


/* Tablette et mobile : bulle à gauche, personnage à droite, en haut */

@media (max-width: 1024px) {
    .peeksee-snake-main {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .peeksee-snake-side {
        order: -1;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 150px;
        gap: 12px;
        align-items: center;
        padding: 0;
    }

    .peeksee-snake-message {
        grid-column: 1;
        grid-row: 1;
        font-size: 14px;
    }

    .peeksee-snake-message::after {
        right: -13px;
        bottom: 50%;
        transform: translateY(50%) rotate(-45deg);
    }

    .peeksee-snake-panda-large {
        grid-column: 2;
        grid-row: 1;
        width: 150px;
    }

    .peeksee-snake-restart-outside {
        display: none;
    }

    .peeksee-snake-restart-mobile {
        display: flex;
        justify-content: center;
        margin-top: 14px;
    }

    .peeksee-snake-scroll-anchor-desktop {
        display: none;
    }

    .peeksee-snake-scroll-anchor-mobile {
        display: block;
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .peeksee-snake-card {
        padding: 14px;
    }
}


/* Petit mobile */

@media (max-width: 480px) {
    .peeksee-snake-card {
        padding: 10px;
    }

    .peeksee-snake-side {
        grid-template-columns: minmax(0, 1fr) 105px;
        gap: 8px;
    }

    .peeksee-snake-panda-large {
        width: 105px;
    }

    .peeksee-snake-message {
        padding: 12px;
        font-size: 13px;
    }

    .peeksee-snake-current-level {
        margin-bottom: 8px;
        font-size: 15px;
    }

    .peeksee-snake-status {
        margin-bottom: 8px;
    }

    .peeksee-snake-progress {
        gap: 5px;
    }

    .peeksee-snake-progress-dot {
        width: 13px;
        height: 13px;
        border-width: 2px;
    }

    .peeksee-snake-hearts {
        font-size: 15px;
    }

    .peeksee-snake-consigne {
        gap: 5px;
        padding: 6px;
        margin-bottom: 8px;
    }

    .peeksee-snake-box {
        padding: 4px 3px 6px;
        border-radius: 14px;
    }

    .peeksee-snake-box small {
        font-size: 10px;
    }

    .peeksee-snake-box strong {
        font-size: 18px;
    }

    .peeksee-snake-box em {
        font-size: 10px;
    }

    .peeksee-snake-apple span {
        padding: 0 5px;
        border-width: 2px;
    }

    .peeksee-snake-controls {
        grid-template-columns: 52px 52px 52px;
        grid-template-rows: 46px 46px 46px;
        gap: 6px;
        margin-top: 6px;
    }

    .peeksee-snake-hint {
        margin-top: 6px;
        font-size: 13px;
    }
}
