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

body {
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.input-section,
.preview-section {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h2 {
    color: #333;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-size: 16px;
}

.controls,
button {
    display: inline-flex;
    align-items: center;
}

.preview-area {
    width: 515px;
    min-height: 582px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
}

.text-preview {
    width: 100%;
    min-height: 542px;
    color: #2c3e50;
    font-size: 20px;
    line-height: 2;
    text-align: justify;
    padding: 25px 35px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    background-color: white;
}

.text-preview br {
    content: '';
    display: block;
    margin-top: 15px;
}

.paragraph {

    font-family: "KaiTi", "楷体", serif;
    color: #2c3e50;
    font-size: 20px;
    line-height: 2;
    text-align: justify;
}

.paragraph-number {
    margin-right: 12px;
    color: #862d2d;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.preview-header h2 {
    margin-bottom: 0;
}

.export-btn {
    display: inline-flex;
    background-color: #862d2d;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.export-btn:hover {
    background-color: #6e2424;
}

.style-selector {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.style-btn {
    padding: 8px 16px;
    border: 1px solid #862d2d;
    background: white;
    color: #862d2d;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.style-btn:hover {
    background: #f4f1e8;
}

.style-btn.active {
    background: #862d2d;
    color: white;
}

.bg-color-selector {
    margin: 15px 0;
}

.bg-color-selector h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.color-options {
    display: flex;
    gap: 10px;
}

.color-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-block;
}

.color-btn:hover {
    border-color: #862d2d;
}

.color-btn.active {
    border-color: #862d2d;
    box-shadow: 0 0 0 2px rgba(134, 45, 45, 0.2);
}

/* 古诗词样式 */
.text-preview.poetry {
    /* 保持与基础样式一致 */
}

.poetry-content {
    position: relative;
    z-index: 1;
}

.poetry .content-title {
    /* 保持与基础样式一致 */
}

.poetry .author {
    text-align: center;
    font-size: 18px;
    margin: 0px 0 20px;
    color: #666;
}

.verse-group {
    margin-bottom: 15px;
}

.verse-group:last-child {
    margin-bottom: 0;
}

.poetry .verse {
    text-align: center;
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 15px;
}

.poetry .note {
    margin-top: 30px;
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    border-top: 0.5px solid rgba(134, 45, 45, 0.5);
    padding-top: 20px;
    font-family: "Microsoft YaHei", sans-serif;
}

.poetry::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background-image: url('img/icon.png');
    background-size: contain;
    opacity: 0.03;
    pointer-events: none;
}

.poetry-insight-wrapper {
    margin-top: 20px;
}

.poetry-insight-wrapper h3 {
    color: #862d2d;
    font-size: 16px;
    margin-bottom: 10px;
}

#insightInput {
    margin-bottom: 15px;
}

/* 修改古诗感悟的展示样式 */
.poetry .insight {
    margin-top: 40px;
    padding: 25px;
    background: rgba(134, 45, 45, 0.04);
    border-radius: 8px;
    position: relative;
    border: 1px solid rgba(134, 45, 45, 0.15);
    box-shadow: 0 2px 10px rgba(134, 45, 45, 0.05);
}

.poetry .insight::before {
    content: "再读感悟";
    position: absolute;
    top: -12px;
    left: 30px;
    background: #f4f1e8;
    padding: 0 15px;
    color: #862d2d;
    font-size: 16px;
    font-family: "Microsoft YaHei", sans-serif;
    font-weight: bold;
    letter-spacing: 2px;
}

.poetry .insight::after {
    content: "「";
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 60px;
    color: rgba(134, 45, 45, 0.1);
    font-family: "Microsoft YaHei", sans-serif;
    line-height: 1;
}

.poetry .insight-content {
    font-size: 16px;
    line-height: 2;
    color: #444;
    font-family: "Microsoft YaHei", sans-serif;
    text-align: justify;
    white-space: pre-wrap;
    padding-left: 25px;
    position: relative;
    text-indent: 2em;
    letter-spacing: 1px;
}

.poetry .insight-content::after {
    content: "」";
    position: absolute;
    bottom: -20px;
    right: 0;
    font-size: 60px;
    color: rgba(134, 45, 45, 0.1);
    font-family: "Microsoft YaHei", sans-serif;
    line-height: 1;
    transform: translateY(50%);
}

.rich-note p {
    margin: 0.8em 0;
}

.rich-note table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.rich-note table td,
.rich-note table th {
    border: 1px solid var(--border-color);
    padding: 8px;
}

/* 确保编辑器内容区域样式正确 */
.tox-edit-area__iframe {
    background-color: white !important;
}

[data-theme="dark"] .tox-edit-area__iframe {
    background-color: #1e1e1e !important;
}

.rich-note h1,
.rich-note h2,
.rich-note h3,
.rich-note h4,
.rich-note h5,
.rich-note h6 {
    margin: 1em 0 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.rich-note h1 {
    font-size: 2em;
}

.rich-note h2 {
    font-size: 1.5em;
}

.rich-note h3 {
    font-size: 1.25em;
}

.rich-note h4 {
    font-size: 1em;
}

.rich-note ul,
.rich-note ol {
    margin: 0.5em 0;
    padding-left: 2em;
}

.rich-note li {
    margin: 0.3em 0;
}

.rich-note table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.rich-note th,
.rich-note td {
    border: 1px solid var(--border-color);
    padding: 0.5em;
}

.rich-note th {
    background-color: var(--bg-color-light);
}

.rich-note blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid var(--border-color);
    background-color: var(--bg-color-light);
}

.rich-note code {
    font-family: monospace;
    background-color: var(--bg-color-light);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.rich-note pre {
    background-color: var(--bg-color-light);
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
}

.rich-note pre code {
    background-color: transparent;
    padding: 0;
}

.rich-note a {
    color: var(--link-color);
    text-decoration: none;
}

.rich-note a:hover {
    text-decoration: underline;
}

/* TinyMCE编辑器容器样式 */
#richTextEditor {
    margin: 1em 0;
    /* 创建新的堆叠上下文，避免z-index冲突 */
    isolation: isolate;
}

/* TinyMCE编辑器容器样式 */
.tox-tinymce {
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
}

/* 限制TinyMCE弹出框的影响范围 */
.tox.tox-tinymce-aux {
    z-index: 99999;
    /* 确保弹出框在最上层 */
}

/* 覆盖TinyMCE默认字体 */
.tox .tox-edit-area__iframe {
    font-family: "Microsoft YaHei", sans-serif !important;
}

/* 修复TinyMCE菜单样式 */
.tox .tox-menu {
    background-color: white !important;
    border: 1px solid #ccc !important;
}

.tox .tox-collection__item {
    color: #333 !important;
}

.tox .tox-collection__item--active {
    background-color: #e6e6e6 !important;
}

/* 修复TinyMCE按钮样式 */
.tox .tox-tbtn {
    color: #333 !important;
}

.tox .tox-tbtn:hover {
    background-color: #e6e6e6 !important;
}

/* 适配深色主题 */
[data-theme="dark"] .tox-tinymce {
    border-color: var(--border-color-dark) !important;
}

[data-theme="dark"] .tox .tox-menu {
    background-color: #2d2d2d !important;
    border-color: #444 !important;
}

[data-theme="dark"] .tox .tox-collection__item {
    color: #fff !important;
}

[data-theme="dark"] .tox .tox-collection__item--active {
    background-color: #444 !important;
}

[data-theme="dark"] .tox .tox-tbtn {
    color: #fff !important;
}

[data-theme="dark"] .tox .tox-tbtn:hover {
    background-color: #444 !important;
}

.rich-note p {
    margin: 0.8em 0;
}

.rich-note table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.rich-note table td,
.rich-note table th {
    border: 1px solid var(--border-color);
    padding: 8px;
}

/* 确保编辑器内容区域样式正确 */
.tox-edit-area__iframe {
    background-color: white !important;
}

[data-theme="dark"] .tox-edit-area__iframe {
    background-color: #1e1e1e !important;
}

.header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 3px;
    border-bottom: 0.5px solid rgba(134, 45, 45, 0.5);
}

.header-left {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
}

.logo-text {
    font-size: 18px;
    color: #222;
    font-weight: bold;
    letter-spacing: 1px;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 10px;
    color: #862d2d;
    margin-top: 2px;
    font-weight: 300;
    letter-spacing: 0.5px;
    font-family: 'Segoe Script', 'Bradley Hand', 'Brush Script MT', cursive;
    transform: scale(0.9);
    margin-left: -3px;
    line-height: 1;
}

.seal {
    width: 35px;
    height: 35px;
    object-fit: contain;
    margin-top: -2px;
    display: block;
    position: relative;
    top: 0;
}

.header-right {
    font-size: 13px;
    color: #222;
    padding-top: 3px;
    font-weight: 300;
}

.content-title {
    font-size: 24px;
    color: #222;
    text-align: center;
    margin: 20px 0 30px;
    font-weight: bold;
    font-family: "KaiTi", "楷体", serif;
    letter-spacing: 2px;
    position: relative;
}

.content-title::before,
.content-title::after {
    content: "";
    color: #862d2d;
    margin: 0 15px;
    opacity: 0.6;
}

.text-preview br {
    content: '';
    display: block;
    margin-top: 15px;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.width-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

.width-control input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.width-control input:focus {
    outline: none;
    border-color: #862d2d;
    box-shadow: 0 0 0 2px rgba(134, 45, 45, 0.1);
}

.width-control span {
    color: #666;
}