/* --- Bandeau tout en haut du site --- */
#spg-top-banner {
    position: relative;
    width: 100%;
    background: #f4c700;
    color: #111;
    text-align: center;
    padding: 10px 40px;
    font-weight: 600;
    font-size: 14px;
    box-sizing: border-box;
    z-index: 999996;
}
#spg-top-banner-link {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
#spg-banner-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #111;
}
#spg-top-banner.spg-banner-hidden { display: none; }

@media (max-width: 480px) {
    #spg-top-banner { font-size: 12.5px; padding: 10px 34px; }
}

/* --- Bouton flottant --- */
#spg-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999997;
    background: linear-gradient(180deg, #001b56 0%, #0e4bdd 100%);
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 16px 24px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,27,86,.35);
    animation: spg-pulse 2.2s ease-in-out infinite;
}
#spg-floating-btn:hover {
    animation-play-state: paused;
    transform: scale(1.05);
}

@keyframes spg-pulse {
    0%   { box-shadow: 0 4px 14px rgba(0,27,86,.35), 0 0 0 0 rgba(14,75,221,.55); }
    70%  { box-shadow: 0 4px 14px rgba(0,27,86,.35), 0 0 0 14px rgba(14,75,221,0); }
    100% { box-shadow: 0 4px 14px rgba(0,27,86,.35), 0 0 0 0 rgba(14,75,221,0); }
}

@media (prefers-reduced-motion: reduce) {
    #spg-floating-btn { animation: none; }
}

#spg-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    opacity: 0; visibility: hidden; transition: opacity .25s ease;
    z-index: 999998;
}
.spg-overlay-visible { opacity: 1 !important; visibility: visible !important; }

#spg-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(.95);
    background: #fff;
    border-radius: 8px;
    max-width: 480px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px 20px 20px;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, transform .25s ease;
}
.spg-modal-open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

#spg-modal-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none; font-size: 26px; cursor: pointer; line-height: 1;
}

.spg-puzzle-instance { text-align: center; font-family: inherit; }

.spg-puzzle-grid {
    display: grid;
    grid-template-columns: repeat(var(--spg-grid-size), 1fr);
    gap: 2px;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 20px auto;
    border: 2px solid #222;
    touch-action: manipulation;
}

.spg-piece {
    width: 100%; height: 100%;
    cursor: pointer;
    background-repeat: no-repeat;
    border: 1px solid rgba(0,0,0,.15);
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
.spg-selected {
    outline: 3px solid #f4c700;
    outline-offset: -3px;
    z-index: 2;
    position: relative;
}

.spg-victory-panel { padding: 10px 0; }

.spg-gift-form input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.spg-form-row { display: flex; gap: 8px; }
.spg-form-row input { flex: 1; }

.spg-btn {
    background: #222; color: #fff; border: none; padding: 12px 20px;
    border-radius: 4px; cursor: pointer; font-weight: 600; width: 100%; margin-top: 8px;
}

@media (max-width: 480px) {
    #spg-modal { padding: 24px 14px 14px; }
}

/* --- Puzzle affiché en direct sur une page via le shortcode [jeu_puzzle] --- */
.spg-puzzle-instance.spg-inline-embed {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 28px 20px;
    max-width: 480px;
    margin: 20px auto;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
