/* === Sliding Puzzle Styles === */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    min-height: calc(100vh - var(--nav-height));
    padding-top: calc(var(--nav-height) + var(--space-6));
}

/* Layout: preview + board side by side */
.sp-layout {
    display: flex;
    gap: var(--space-5);
    align-items: flex-start;
    justify-content: center;
}

.sp-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.sp-preview img {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    object-fit: cover;
}

.sp-preview__label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.sp-board {
    display: grid;
    gap: 3px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-2xl);
    padding: 4px;
    width: clamp(260px, 70vw, 380px);
    aspect-ratio: 1;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.08), inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.sp-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
}

.sp-tile:hover:not(.sp-tile--empty) {
    transform: scale(1.04);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.4);
    border-color: rgba(255, 255, 255, 0.25);
}

.sp-tile:active:not(.sp-tile--empty) {
    transform: scale(0.97);
}

.sp-tile--empty {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px dashed rgba(255, 255, 255, 0.06);
    cursor: default;
}

.sp-tile--correct {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.35);
}

/* Small number overlay for orientation */
.sp-tile__num {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

/* Info modal */
.info-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.info-modal__card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 420px;
    width: 90%;
    text-align: left;
}

.info-modal__card h2 {
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.info-modal__card ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.info-modal__card li {
    color: var(--text-secondary);
    padding-left: var(--space-4);
    position: relative;
}

.info-modal__card li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-primary-bright);
}

/* Win animation */
.sp-board--won {
    animation: winPulse 0.6s ease;
}

@keyframes winPulse {
    0% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.08);
    }

    50% {
        box-shadow: 0 0 60px rgba(16, 185, 129, 0.4);
    }

    100% {
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.2);
    }
}

@media (max-width: 600px) {
    .sp-layout {
        flex-direction: column;
        align-items: center;
    }

    .sp-preview {
        flex-direction: row;
        gap: var(--space-3);
    }

    .sp-preview img {
        width: 80px;
        height: 80px;
    }

    .sp-board {
        width: min(92vw, 340px);
        padding: 3px;
        gap: 2px;
    }
}