<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="template:media-width" content="1024">
    <meta name="template:media-height" content="1024">
    <meta name="viewport" content="width=1080, height=1920">
    <title>80年代讽刺漫画风格 全屏图片 只有标题 - 1080x1920</title>
    <!-- Google Fonts - 中文字体 -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700;900&family=Noto+Serif+SC:wght@400;700;900&family=Liu+Jian+Mao+Cao&family=Ma+Shan+Zheng&display=swap" rel="stylesheet">
    <style>
        
        * { margin: 0; padding: 0; box-sizing: border-box; }

        html, body { width: 1080px; height: 1920px; overflow: hidden; }

        body {
            font-family: 'Noto Sans SC', 'PingFang SC', 'Source Han Sans', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
            color: #fff;
            position: relative;
            background: transparent; /* 移除黑色背景 */
        }

        /* 背景使用图片并做模糊处理，完全覆盖整个页面 */
        .bg {
            position: relative;
            width: 100%;
            height: 100%;
            background-image: url("{{image}}");
            background-size: cover;
            background-position: center;
            z-index: 0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .title {
            width: 900px;
            text-align: center;
            font-size: 92px;
            font-weight: 800;
            line-height: 1.2;
            text-shadow: 0 6px 22px rgba(0,0,0,0.6),
                        -2px -2px 0 #000,
                        2px -2px 0 #000,
                        -2px 2px 0 #000,
                        2px 2px 0 #000;
            letter-spacing: 4px;
            /* 确保文本不会溢出 */
            word-wrap: break-word;
            overflow-wrap: break-word;
            white-space: nowrap;
        }

        /* Footer */
        .footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 25px 20px 0 20px;
            position: absolute;
            bottom: 20px;
            color: #fff;
            text-shadow: -1px -1px 0 #000,
                        1px -1px 0 #000,
                        -1px 1px 0 #000,
                        1px 1px 0 #000;
        }
        
        .author {
            display: flex;
            flex-direction: column;
            gap: 6px;
            letter-spacing: 2px;
        }
        
        .author-name {
            font-size: 30px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .author-mark {
            width: 8px;
            height: 8px;
            /* border-radius: 50%; */
            /* background: rgba(149, 165, 166, 0.7); */
        }
        
        .author-desc {
            font-size: 22px;
            /* color: #5d6d7e; */
            line-height: 1.3;
            font-weight: 400;
        }
        
        .logo-section {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 8px;
        }
        
        .logo {
            font-size: 24px;
            font-weight: 500;
        }
        
        .logo-marks {
            display: flex;
            gap: 5px;
        }
        
        .logo-mark {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: rgba(149, 165, 166, 0.45);
        }
        
        .logo-mark.active {
            background: rgba(149, 165, 166, 0.75);
        }
    </style>
</head>
<body>
    <div class="bg">
        <div class="title">{{title}}</div>
    </div>
    <div class="footer">
        <div class="author">
            <div class="author-name">
                <span class="author-mark"></span>
                <div class="logo">{{author=@Pixelle.AI}}</div>
            </div>
            <div class="author-desc">{{describe=Open Source Omnimodal AI Creative Agent}}</div>
        </div>
        <div class="logo-section">
            <div class="logo">{{brand=Pixelle-Video}}</div>
            <div class="logo-marks">
                <div class="logo-mark"></div>
                <div class="logo-mark active"></div>
                <div class="logo-mark"></div>
                <div class="logo-mark"></div>
            </div>
        </div>
    </div>
    <script>
        /**
         * 根据文本宽度自动调整字体大小
         * @param {HTMLElement} element - 要调整的元素
         * @param {number} maxWidth - 最大宽度（px）
         * @param {number} minFontSize - 最小字体大小（px）
         * @param {number} maxFontSize - 最大字体大小（px）
         */
        function autoFitFontSize(element, maxWidth, minFontSize, maxFontSize) {
            try {
                if (!element || !element.textContent || !element.textContent.trim()) {
                    return;
                }
                
                if (!document.body) {
                    return;
                }
                
                // 创建一个临时的测量元素
                const measure = document.createElement('span');
                measure.style.visibility = 'hidden';
                measure.style.position = 'absolute';
                measure.style.top = '-9999px';
                measure.style.left = '-9999px';
                measure.style.whiteSpace = 'nowrap';
                
                // 复制元素的样式
                const computedStyle = window.getComputedStyle(element);
                measure.style.fontFamily = computedStyle.fontFamily;
                measure.style.fontSize = computedStyle.fontSize;
                measure.style.fontWeight = computedStyle.fontWeight;
                measure.style.letterSpacing = computedStyle.letterSpacing;
                measure.textContent = element.textContent;
                
                document.body.appendChild(measure);
                
                // 二分查找合适的字体大小
                let low = minFontSize;
                let high = maxFontSize;
                let bestSize = maxFontSize;
                
                // 先检查最大字体是否合适
                measure.style.fontSize = maxFontSize + 'px';
                if (measure.offsetWidth <= maxWidth) {
                    bestSize = maxFontSize;
                } else {
                    // 使用二分查找
                    while (high - low > 0.5) {
                        const mid = (low + high) / 2;
                        measure.style.fontSize = mid + 'px';
                        
                        if (measure.offsetWidth <= maxWidth) {
                            bestSize = mid;
                            low = mid;
                        } else {
                            high = mid;
                        }
                    }
                }
                
                // 应用找到的字体大小
                element.style.fontSize = bestSize + 'px';
                
                // 清理临时元素
                if (measure.parentNode) {
                    document.body.removeChild(measure);
                }
            } catch (error) {
                console.error('自动调整字体大小出错:', error);
            }
        }
        
        // 页面加载完成后自动调整字体大小
        function initAutoFit() {
            try {
                const titleElement = document.querySelector('.title');
                if (titleElement) {
                    // 获取容器的实际宽度
                    const maxWidth = 900;
                    // 自动调整字体大小：最小12px，最大72px
                    autoFitFontSize(titleElement, maxWidth, 12, 72);
                }
            } catch (error) {
                console.error('初始化自动调整字体大小出错:', error);
            }
        }
        
        // 等待 DOM 加载完成
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', initAutoFit);
        } else {
            // DOM 已经加载完成
            initAutoFit();
        }
        
        // 如果内容是通过模板引擎动态插入的，可以监听内容变化
        // 使用 MutationObserver 监听文本变化
        if (typeof MutationObserver !== 'undefined') {
            try {
                const observer = new MutationObserver(function(mutations) {
                    let shouldUpdate = false;
                    mutations.forEach(function(mutation) {
                        if (mutation.type === 'childList' || mutation.type === 'characterData') {
                            shouldUpdate = true;
                        }
                    });
                    
                    if (shouldUpdate) {
                        // 延迟执行，避免频繁调用
                        setTimeout(initAutoFit, 100);
                    }
                });
                
                // 等待 body 元素存在后再观察
                if (document.body) {
                    observer.observe(document.body, {
                        childList: true,
                        subtree: true,
                        characterData: true
                    });
                } else {
                    document.addEventListener('DOMContentLoaded', function() {
                        if (document.body) {
                            observer.observe(document.body, {
                                childList: true,
                                subtree: true,
                                characterData: true
                            });
                        }
                    });
                }
            } catch (error) {
                console.error('设置 MutationObserver 出错:', error);
            }
        }
    </script>
</body>
</html>