/* --- 全局与重置 --- */
body, html {
    margin: 0;
    padding: 0;
    font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft YaHei", "微软雅黑", sans-serif;
    background-color: #f7f8fc;
    color: #333;
    height: 100%;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- 顶栏导航 --- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.top-nav .logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.top-nav .logo img {
    height: 32px;
    margin-right: 12px;
}

.top-nav .logo h1 {
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.top-nav nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.top-nav nav ul li a {
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 500;
    color: #4b5563;
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.top-nav nav ul li a:hover {
    background-color: #f3f4f6;
    color: #007bff;
}

.user-profile img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.user-profile img:hover {
    border-color: #007bff;
}

/* --- 主容器 --- */
.main-container {
    display: flex;
    padding-top: 64px; /* 留出顶栏的高度 */
    height: 100%;
}

/* --- 侧边栏 --- */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 20px 12px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
}

.sidebar .toggle-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 5px;
    margin-bottom: 20px;
    width: 100%;
    text-align: left;
    background-color: #f9fafb;
    border-radius: 6px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    border-radius: 8px;
    margin-bottom: 8px;
    white-space: nowrap; /* 防止文字换行 */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-nav ul li a:hover {
    background-color: #f3f4f6;
}

.sidebar-nav ul li a.active { /* 可以为当前页面添加 active 类 */
    background-color: #e0e7ff;
    color: #4338ca;
    font-weight: 600;
}

/* 侧边栏收起状态 */
.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-nav ul li a {
    justify-content: center;
}

.sidebar.collapsed .sidebar-nav span {
    display: none;
}

.sidebar.collapsed .toggle-btn {
    text-align: center;
}

/* --- 主内容区 --- */
.content {
    flex-grow: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #111827;
}

.main-title h1 {
    font-size: 4.5rem;
    font-weight: 800;
    color: transparent;
    background: linear-gradient(45deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    margin: 0;
    text-align: center;
}

.main-title p {
    font-size: 1.25rem;
    color: #4b5563;
    margin-top: 1rem;
    text-align: center;
}

.dialogue-box {
    width: 100%;
    max-width: 750px;
    margin-top: 2.5rem;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.dialogue-box textarea {
    width: 100%;
    min-height: 150px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dialogue-box textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.generate-btn {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    margin-top: 1.5rem;
    border: none;
    border-radius: 8px;
    background-color: #3b82f6;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.generate-btn:hover {
    background-color: #2563eb;
}

.generate-btn:active {
    transform: scale(0.98);
}

/* 表单容器 (用于登录/注册页) */
.form-container {
    width: 100%;
    max-width: 400px;
    margin-top: 2rem;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.form-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
}
.form-container input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}```

### `static/js/script.js` (完整JS代码)

请将以下代码复制到 `static/js/script.js` 文件中。

```javascript
// 当整个页面的HTML加载完成后执行
document.addEventListener('DOMContentLoaded', function() {

    // 获取侧边栏切换按钮和侧边栏元素
    const toggleBtn = document.querySelector('.toggle-btn');
    const sidebar = document.querySelector('.sidebar');

    // 检查元素是否存在，防止在没有这些元素的页面上报错
    if (toggleBtn && sidebar) {
        // 为切换按钮添加点击事件监听器
        toggleBtn.addEventListener('click', function() {
            // 在侧边栏的 classList 中切换 'collapsed' 类
            // 如果有 'collapsed' 类就移除它，如果没有就添加它
            sidebar.classList.toggle('collapsed');
        });
    }

    // --- (可选) 高亮当前页面的导航链接 ---
    // 获取当前页面的URL路径
    const currentPagePath = window.location.pathname;
    // 获取所有侧边栏导航链接
    const sidebarLinks = document.querySelectorAll('.sidebar-nav a');

    sidebarLinks.forEach(link => {
        // 获取链接的href属性，并从中提取路径部分
        const linkPath = new URL(link.href).pathname;

        // 如果链接的路径与当前页面的路径完全匹配
        if (linkPath === currentPagePath) {
            // 为该链接添加 'active' 类，使其高亮
            link.classList.add('active');
        }
    });

});
/* --- 图片加载失败时的占位符样式 --- */
.logo img,
.user-profile img {
    /* 如果图片加载失败，显示一个灰色背景 */
    background-color: #e5e7eb; 
    
    /* 确保即使图片失败，元素也保持原有尺寸 */
    display: inline-block;
    vertical-align: middle;
    
    /* 隐藏损坏的图片图标和多余的 alt 文本 */
    text-indent: -9999px; 
    color: transparent;
}