* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: linear-gradient(135deg, #fff0f0, #ffe6e9);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 左侧作品列表 */
.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid #ffd9e4;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 100;
}

/* 右侧数据面板通用样式 */
.data-panel {
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-left: 1px solid #ffd9e4;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 100;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.panel-header h2 {
    color: #ff7b9c;
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #ffb3b3;
    cursor: pointer;
}

/* 主工作区 */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    padding: 16px 20px;
    gap: 0;
    overflow: hidden;
}

/* 章节栏 */
.chapter-bar {
    background: #fff9f9;
    border-radius: 20px;
    padding: 12px 16px;
    border: 1px solid #ffe6ec;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(255,155,180,0.1);
}

.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chapter-header h3 {
    font-size: 1rem;
    color: #ff7b9c;
}

.chapter-actions {
    display: flex;
    gap: 8px;
}

.small-btn {
    background: #ffe6ec;
    border: 1px solid #ffd9e4;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}

.small-btn:hover {
    background: #ffd9e4;
}

.small-btn.danger {
    background: #ffb3b3;
    color: white;
    border: none;
}

.small-btn.danger:hover {
    background: #ff8a8a;
}

.chapter-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chapter-list li {
    background: white;
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid #ffd9e4;
    list-style: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.chapter-list li:hover {
    background: #fff0f5;
}

.chapter-list li.active {
    background: #ff9eb5;
    color: white;
    border-color: #ff9eb5;
}

/* 正文编辑区 */
.editor-area {
    flex: 2;
    min-height: 100px;
    border: 1px solid #ffe6ec;
    border-radius: 20px;
    overflow: hidden;
    background: #fff9f9;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(255,155,180,0.1);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #fff0f5;
    border-bottom: 1px solid #ffe6ec;
}

.editor-header h3 {
    font-size: 1rem;
    color: #ff7b9c;
}

.generate-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.word-count-display {
    font-size: 0.9rem;
    color: #ff7b9c;
    background: #fff0f5;
    padding: 4px 12px;
    border-radius: 30px;
    white-space: nowrap;
}

.word-count-input {
    width: 90px;
    padding: 6px 10px;
    border: 1px solid #ffd9e4;
    border-radius: 30px;
    font-size: 0.9rem;
    text-align: center;
    background: white;
}

.generate-btn {
    background: #ff9eb5;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.generate-btn:hover {
    background: #ff7b9c;
}

#chapter-content {
    width: 100%;
    flex: 1;
    padding: 20px;
    border: none;
    resize: none;
    font-size: 1rem;
    line-height: 1.6;
    background: transparent;
    outline: none;
    font-family: 'Georgia', serif;
    overflow-y: auto;
}

/* 可拖拽分隔条 */
.splitter {
    height: 6px;
    background: #ffe6ec;
    cursor: ns-resize;
    transition: background 0.2s;
    margin: 0 -20px;
    position: relative;
    z-index: 10;
}

.splitter:hover,
.splitter:active {
    background: #ff9eb5;
}

/* 对话区 */
.chat-area {
    flex: 3;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff9f9;
    border-radius: 20px;
    padding: 16px;
    border: 1px solid #ffe6ec;
    overflow: hidden;
    margin-top: 0;
    box-shadow: 0 2px 8px rgba(255,155,180,0.1);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1rem;
    color: #ff7b9c;
}

/* 附件栏 */
.attachment-bar {
    background: #fff0f5;
    border-radius: 16px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.attachment-label {
    font-size: 0.9rem;
    color: #ff7b9c;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.attachment-item {
    background: white;
    border-radius: 30px;
    padding: 4px 10px 4px 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #ffd9e4;
    font-size: 0.85rem;
}

.attachment-item button {
    background: none;
    border: none;
    color: #ff8a8a;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 16px;
}

.message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.user-message {
    background: #ff9eb5;
    color: white;
    align-self: flex-end;
}

.ai-message {
    background: #fff0f5;
    color: #ff7b9c;
    align-self: flex-start;
}

.placeholder {
    color: #ffb3b3;
    text-align: center;
    margin-top: 20px;
    font-style: italic;
}

/* 输入行 */
.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #ffe6ec;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
    align-self: flex-end;
    margin-bottom: 5px;
}

.attach-btn:hover {
    background: #ffd9e4;
}

.input-row textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ffd9e4;
    border-radius: 30px;
    resize: vertical;
    font-size: 0.95rem;
    max-height: 200px;
    overflow-y: auto;
    background: white;
}

.send-btn {
    background: #ff9eb5;
    color: white;
    border: none;
    width: 70px;
    height: 70px;
    border-radius: 35px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255,155,180,0.3);
}

.send-btn:hover {
    background: #ff7b9c;
}

/* 移动端底部导航 */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    border-top: 1px solid #ffd9e4;
    padding: 8px 0;
    z-index: 1000;
    justify-content: space-around;
}

.nav-btn {
    background: none;
    border: none;
    font-size: 1rem;
    padding: 8px 12px;
    color: #ff7b9c;
    cursor: pointer;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .app {
        height: calc(100vh - 60px); /* 留出底部导航空间 */
    }

    .sidebar, .data-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }

    .sidebar.active, .data-panel.active {
        transform: translateX(0);
    }

    .data-panel {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }

    .data-panel.active {
        transform: translateX(0);
    }

    .mobile-nav {
        display: flex;
    }

    .main {
        padding: 8px;
    }

    .chapter-bar {
        margin-bottom: 8px;
    }

    .editor-area {
        flex: 2;
        min-height: 150px;
    }

    .chat-area {
        flex: 3;
        min-height: 200px;
    }

    .splitter {
        display: none;
    }

    .input-row textarea {
        max-height: 80px;
    }

    .send-btn {
        width: 60px;
        height: 60px;
    }

    /* 隐藏桌面端多余的侧边栏，因为移动端用抽屉 */
    .sidebar, .data-panel {
        display: flex;
    }
}

/* 其他样式 */
.work-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.work-list li {
    background: white;
    padding: 12px;
    border-radius: 20px;
    border: 1px solid #ffe6ec;
    cursor: pointer;
    font-size: 0.95rem;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(255,155,180,0.1);
}

.work-list li:hover {
    background: #fff0f5;
    border-color: #ff9eb5;
}

.material-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.material-item {
    background: #fff9f9;
    border-radius: 16px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ffe6ec;
}

/* 预设管理 */
.preset-section {
    margin-top: 8px;
    border-top: 1px solid #ffe6ec;
    padding-top: 8px;
}

#preset-list {
    width: 100%;
    background: white;
    border: 1px solid #ffd9e4;
    border-radius: 16px;
    padding: 4px;
    margin-bottom: 8px;
}

.preset-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

#preset-editor {
    width: 100%;
    border: 1px solid #ffd9e4;
    border-radius: 16px;
    padding: 6px;
    font-size: 0.8rem;
    background: white;
}

/* 模态框 */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 200, 210, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 32px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 30px rgba(255,155,180,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #ffe6ec;
}

.modal-header h2 {
    color: #ff7b9c;
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #ffb3b3;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ff7b9c;
}

.modal-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #ffd9e4;
    border-radius: 20px;
    font-size: 1rem;
    background: white;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 24px;
    border-top: 1px solid #ffe6ec;
}