﻿/* =========================================================
   Puzzles — Konva Real Jigsaw (Canvas)
   ========================================================= */

.puzzle-wrapper {
    position: relative;
}

.puzzle-host {
    width: 100%;
    /* Fit the table on screen below the fixed navbar. A fixed 860px minimum
       ran past the bottom of typical laptop screens (about 650px of usable
       height on a 1366×768 display), so players had to scroll while dragging. */
    height: min(calc(100vh - var(--ss-nav-total-h, 110px) - 2rem), 1080px);
    min-height: 520px;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255,255,255,.60);
    position: relative;
}

    .puzzle-host canvas {
        display: block;
    }

@media (max-width: 768px) {
    .puzzle-host {
        height: 70vh;
        min-height: 520px;
        border-radius: 12px;
    }
}

/* Floating reference preview (draggable) */
.puzzle-preview {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 240px;
    max-width: 42vw;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,.20);
    padding: 8px;
    z-index: 30;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

    .puzzle-preview.dragging {
        cursor: grabbing;
    }

    .puzzle-preview img {
        width: 100%;
        height: auto;
        display: block;
        border-radius: 8px;
        -webkit-user-drag: none;
        user-select: none;
        pointer-events: none;
    }

    .puzzle-preview.hidden {
        display: none;
    }

/* ---------------------------------------------------------
   Completion overlay
   --------------------------------------------------------- */

.pz-complete-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    border-radius: 16px;
    animation: pz-fade-in 0.4s ease;
}

@keyframes pz-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pz-complete-card {
    background: #f7f4ee;
    border-radius: 18px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    animation: pz-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pz-pop-in {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pz-complete-icon {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.pz-complete-title {
    font-size: 1.6rem;
    font-weight: 400;
    font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    color: #3b3732;
    margin: 0 0 0.5rem;
}

.pz-complete-sub {
    color: #7a756f;
    font-size: 0.95rem;
    margin: 0 0 1.5rem;
}

.pz-complete-btn {
    width: 100%;
    display: block;
    margin-bottom: 0.5rem;
}
