#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: 14px 20px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

#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-container { 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: 980 / 800;
    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; }
	#spg-floating-btn { left: 24px!important; right: auto!important; }
}
