* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container { max-width: 1400px; margin: 0 auto; }

.header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.header h1 { color: #2c3e50; font-size: 1.8em; margin-bottom: 6px; }
.subtitle { color: #7f8c8d; font-size: 1em; }

/* 工具栏 */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #3498db; color: white; }
.btn-success { background: #2ecc71; color: white; }
.btn-download { background: #9b59b6; color: white; }
.btn-copy { background: #e74c3c; color: white; }

.filename { color: #7f8c8d; font-size: 14px; margin-left: 10px; }

/* 调试面板 */
.debug-panel {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    max-height: 200px;
    overflow: auto;
}
.debug-panel h3 { color: #856404; margin-bottom: 8px; font-size: 14px; }
#debugInfo { color: #555; white-space: pre-wrap; font-family: monospace; line-height: 1.6; }

/* 渲染容器 - 固定678px，居中显示 */
.render-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.render-container {
    width: 678px;
    min-width: 678px;
    background: white;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    min-height: 200px;
}

.placeholder { color: #aaa; font-style: italic; text-align: center; padding: 40px 0; }

/* ==========================================
   正文渲染样式 - 公文格式
   ========================================== */
.render-container .doc-content {
    font-family: "SimSun", "宋体", serif;
    font-size: 16px;
    line-height: 1.8;
    color: #000;
    width: 100%;
}

.render-container .doc-content p {
    margin: 8px 0;
    text-align: justify;
    text-indent: 2em;
    word-break: break-word;
}

.render-container .doc-content strong {
    font-weight: bold;
}

/* 表格样式 */
.render-container .doc-content table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
    table-layout: auto;
}

.render-container .doc-content td,
.render-container .doc-content th {
    border: 1px solid #000;
    padding: 4px 8px;
    text-align: center;
    vertical-align: middle;
    font-size: 14px;
    word-break: break-word;
}

/* 表格内的段落去掉首行缩进 */
.render-container .doc-content td p,
.render-container .doc-content th p {
    text-indent: 0;
    margin: 0;
    text-align: center;
}

/* 图片 */
.render-container .doc-content img {
    max-width: 100%;
    height: auto;
}

/* 预览区 */
.preview-area {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.preview-area h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}
.preview-container {
    min-height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #fafafa;
    overflow: auto;
}
.preview-placeholder { color: #999; font-style: italic; }
.preview-actions { display: flex; gap: 12px; }

/* 【改动】预览图片限制显示宽度为678px，保持1:1观感 */
.preview-container img {
    max-width: 678px;
    width: auto;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}