/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: SimSun, serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 字体渲染优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 全局字体继承规则 - 确保所有文本元素都能正确应用字体 */
.editor-wrapper * {
    font-family: inherit !important;
}

/* 特别指定主要文本区域的字体继承和颜色 */
.date-content,
.brand-content,
.main-text-input,
.title-content,
.author-content,
.content-column,
[contenteditable="true"] {
    font-family: inherit;
    color: #333;
    /* 字体渲染优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 工具栏样式 */
.toolbar {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-family: Source Han Sans SC, Noto Sans SC, sans-serif;
}

.toolbar * {
    font-family: Source Han Sans SC, Noto Sans SC, sans-serif;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-section label {
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.toolbar-section select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 边框粗细调节样式 */
.toolbar-section input[type="range"] {
    width: 100px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    border: none;
    padding: 0;
}

.toolbar-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #666666;
    border-radius: 50%;
    cursor: pointer;
}

.toolbar-section input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #666666;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* 字体控制样式 */
.font-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.font-control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.font-control-item label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    min-width: 40px;
}

.font-control-item input[type="range"] {
    width: 80px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.font-control-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #666666;
    border-radius: 50%;
    cursor: pointer;
}

.font-control-item input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #666666;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.font-control-item span {
    font-size: 12px;
    font-weight: 500;
    color: #666666;
    min-width: 35px;
    text-align: right;
}

.toolbar-section button {
    padding: 6px 12px;
    background: #666666;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.toolbar-section button:hover {
    background: #444444;
}

.inline-hint {
    font-size: 12px;
    color: #666666;
    margin-left: 8px;
    font-family: Source Han Sans SC, Noto Sans SC, sans-serif;
}

.inline-hint-danger {
    color: #d93025;
}

.hover-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    background: #fff;
    color: #555;
    font-size: 12px;
    line-height: 1;
    cursor: help;
    user-select: none;
}

.hover-tip:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 102, 102, 0.25);
}

.hover-tip-content {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 10px;
    background: rgba(17, 17, 17, 0.92);
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.hover-tip:hover .hover-tip-content,
.hover-tip:focus .hover-tip-content {
    opacity: 1;
}

/* 编辑器容器 */
.editor-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 0;
    overflow-x: auto; /* 允许水平滚动 */
    padding: 0 20px; /* 增加水平内边距 */
    width: 100%;
}

.editor-wrapper {
    position: relative;
    background: transparent; /* 改为透明，让背景图片可见 */
    border: 2px solid #555;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    overflow: visible; /* 允许内容向左溢出，自动换列 */
    margin: 20px;
    flex-shrink: 0;
}

/* 默认1:1布局 - 基准尺寸，更智能的适应屏幕 */
.editor-wrapper {
    /* 使用更智能的尺寸计算，优先考虑屏幕适应性 */
    width: min(600px, 85vw);
    height: min(600px, 85vh);
    aspect-ratio: 1/1;
}

/* 布局比例样式 - 精确比例控制，更好的屏幕适应 */
.editor-wrapper.layout-3-4 {
    /* 3:4 比例 - 适应屏幕的智能尺寸 */
    width: min(450px, 70vw, calc(85vh * 3/4)) !important;
    height: min(600px, 85vh, calc(70vw * 4/3)) !important;
    aspect-ratio: 3/4 !important;
}

.editor-wrapper.layout-4-3 {
    /* 4:3 比例 - 横向布局优化 */
    width: min(600px, 85vw, calc(70vh * 4/3)) !important;
    height: min(450px, 70vh, calc(85vw * 3/4)) !important;
    aspect-ratio: 4/3 !important;
}

.editor-wrapper.layout-16-9 {
    /* 16:9 比例 - 宽屏优化 */
    width: min(640px, 85vw, calc(60vh * 16/9)) !important;
    height: min(360px, 60vh, calc(85vw * 9/16)) !important;
    aspect-ratio: 16/9 !important;
}

.editor-wrapper.layout-9-16 {
    /* 9:16 比例 - 竖屏优化 */
    width: min(360px, 60vw, calc(85vh * 9/16)) !important;
    height: min(640px, 85vh, calc(60vw * 16/9)) !important;
    aspect-ratio: 9/16 !important;
}

.editor-wrapper.layout-9-16 .left-column {
    overflow: hidden;
}

.editor-wrapper.layout-9-16 .brand-section {
    overflow: hidden;
}

.editor-wrapper.layout-9-16 .brand-content {
    max-height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    font-size: 14px !important;
    line-height: 1.4 !important;
    padding: 10px 6px !important;
    letter-spacing: 0.05em;
    border-width: 2px !important;
}

.editor-wrapper.layout-1-1 {
    width: min(600px, 85vw) !important;
    height: min(600px, 85vh) !important;
    aspect-ratio: 1/1 !important;
}

/* 确保所有布局都有合理的最小尺寸 */
.editor-wrapper,
.editor-wrapper.layout-3-4,
.editor-wrapper.layout-4-3,
.editor-wrapper.layout-16-9,
.editor-wrapper.layout-9-16 {
    min-width: 250px;
    min-height: 250px;
}

/* 栏目基础样式 */
.left-column,
.center-column,
.right-column {
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 1;
    background: transparent; /* 确保栏目背景透明 */
}

/* 添加左右边框线 */
.left-column {
    border-right: 1px solid #000;
}

.right-column {
    border-left: 1px solid #000;
    justify-content: space-between;
    padding-top: clamp(48px, 12vh, 120px);
    padding-bottom: clamp(48px, 12vh, 120px);
}

/* 栏目宽度分配 - 采用flex比例确保精确分配 */
.left-column {
    flex: 0 0 10%; /* 固定10%宽度 */
    min-width: 50px; /* 最小宽度适应小屏幕 */
    max-width: 80px; /* 适当增加最大宽度，保持与右侧的比例关系 */
    position: relative;
    z-index: 1; /* 确保在上层 */
}

.center-column {
    flex: 0 0 70%; /* 固定70%宽度 */
    min-width: 150px; /* 减少最小宽度，给左右栏目更多空间 */
    overflow: visible; /* 允许内容向左溢出 */
    position: relative;
    z-index: 0;
}

.right-column {
    flex: 0 0 20%; /* 固定20%宽度 */
    min-width: 100px; /* 调整最小宽度，保持与左侧2:1的比例关系 */
    max-width: 160px; /* 调整最大宽度限制，确保比例正确 */
    position: relative;
    z-index: 1; /* 确保在上层 */
}

/* 确保在所有布局比例下栏目宽度保持一致 */
.editor-wrapper.layout-3-4 .left-column,
.editor-wrapper.layout-4-3 .left-column,
.editor-wrapper.layout-16-9 .left-column,
.editor-wrapper.layout-9-16 .left-column,
.editor-wrapper.layout-1-1 .left-column {
    flex: 0 0 10% !important;
    min-width: 0 !important; /* 移除最小宽度限制，让flex比例生效 */
    max-width: none !important; /* 移除最大宽度限制 */
}

.editor-wrapper.layout-3-4 .center-column,
.editor-wrapper.layout-4-3 .center-column,
.editor-wrapper.layout-16-9 .center-column,
.editor-wrapper.layout-9-16 .center-column,
.editor-wrapper.layout-1-1 .center-column {
    flex: 0 0 70% !important;
    min-width: 0 !important;
}

.editor-wrapper.layout-3-4 .right-column,
.editor-wrapper.layout-4-3 .right-column,
.editor-wrapper.layout-16-9 .right-column,
.editor-wrapper.layout-9-16 .right-column,
.editor-wrapper.layout-1-1 .right-column {
    flex: 0 0 20% !important;
    min-width: 0 !important; /* 移除最小宽度限制，让flex比例生效 */
    max-width: none !important; /* 移除最大宽度限制 */
}

.editor-wrapper.layout-1-1 .right-column {
    justify-content: space-between;
}

.editor-wrapper.layout-1-1 .title-section,
.editor-wrapper.layout-1-1 .author-section {
    flex: 0 0 auto;
}

/* 竖排文字样式 */
.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px 10px;
    font-size: 16px;
    line-height: 1.8;
    letter-spacing: 0.1em;
}





/* 左侧栏目内容 - 补偿右边框1px确保视觉距离相等 */
.date-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 13px 20px 12px; /* 右侧多1px补偿border-right的1px宽度 */
    text-align: center;
    background: transparent; /* 确保透明背景 */
}

.date-content {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    font-size: 16px;
    line-height: 2;
    letter-spacing: 0.1em;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 13px 20px 12px; /* 右侧多1px补偿border-right的1px宽度 */
    text-align: center;
    background: transparent; /* 确保透明背景 */
}

.brand-content {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0.05em;
    background: transparent;
    color: #FF3B30 !important; /* 品牌内容保持红色 */
    border: 2px solid #FF3B30;
    padding: 8px 4px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.brand-content:hover {
    background: rgba(255, 230, 230, 0.3);
    color: #CC0000;
    border-color: #CC0000;
}

/* 中间栏目内容 - 支持向左扩展换列 */
.content-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center; /* 默认居中显示（失焦状态） */
    padding: 20px 15px;
    min-height: 200px;
    overflow: visible; /* 允许向左溢出 */
    position: relative;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}

/* 失焦时居中显示的类 */
.content-section.centered {
    justify-content: center;
}

/* 聚焦时右对齐的类 */
.content-section.right-aligned {
    justify-content: flex-end;
}

.content-section.composition-horizontal {
    justify-content: flex-start;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: hidden;
    padding: 0;
}

/* 主要文本输入区域样式 - 限制在中间栏内 */
.main-text-input {
    width: auto;
    min-width: 60px;
    max-height: calc(100vh - 240px); /* 设置最大高度限制 */
    height: auto; /* 改为自动高度 */
    border: none;
    outline: none;
    background: transparent;
    resize: none;
    
    /* 竖排文字设置 */
    writing-mode: vertical-rl;
    text-orientation: upright;
    
    /* 字体样式 */
    font-family: inherit;
    font-size: 22px;
    line-height: 1.8;
    color: #333;
    letter-spacing: 0.1em;
    
    /* 布局设置 - 限制在父容器内 */
    padding: 10px;
    text-align: start;
    overflow-y: hidden; /* 垂直方向隐藏溢出 */
    overflow-x: visible;
    white-space: pre;
    word-break: keep-all;
    word-wrap: normal;
    flex-shrink: 0; /* 不收缩 */
    
    /* 跨浏览器兼容性 */
    -webkit-writing-mode: vertical-rl;
    -ms-writing-mode: tb-rl;
    -webkit-text-orientation: upright;
    -ms-text-orientation: upright;
    
    box-sizing: border-box;
}

.main-text-input.composition-horizontal {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
    width: 100%;
    height: 100%;
    max-height: none;
    flex: 0 0 100%;
    padding: 20px 15px;
    letter-spacing: 0.02em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.is-hidden {
    display: none;
}

.modal {
    width: min(560px, 92vw);
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    padding: 18px 18px 16px;
    font-family: Source Han Sans SC, Noto Sans SC, sans-serif;
}

.modal h3 {
    font-size: 16px;
    margin: 0 0 10px;
    color: #111;
}

.modal ol {
    padding-left: 18px;
    margin: 0 0 12px;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

.agreement-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #333;
    user-select: none;
    margin: 10px 0 14px;
}

.agreement-checkbox input[type="checkbox"] {
    margin-top: 2px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-actions button {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 14px;
}

.modal-actions button.primary {
    background: #666666;
    color: #fff;
    border-color: #666666;
}

.main-text-input:focus {
    background-color: rgba(74, 144, 226, 0.05);
    border-radius: 4px;
}

/* 隐藏滚动条 */
.content-section::-webkit-scrollbar,
.main-text-input::-webkit-scrollbar {
    display: none;
}

.content-section,
.main-text-input {
    -ms-overflow-style: none;  /* IE 和 Edge */
    scrollbar-width: none;  /* Firefox */
}

/* contenteditable placeholder 样式 */
.main-text-input:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
    opacity: 0.6;
}

.main-text-input:focus:empty:before {
    opacity: 0.4;
}

.main-text-input::placeholder {
    color: #999;
    font-style: italic;
}

.page-controls {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-family: Source Han Sans SC, Noto Sans SC, sans-serif;
    font-size: 13px;
    color: #666;
}

.page-controls.is-hidden {
    display: none;
}

.site-footer {
    margin-top: auto;
    padding: 14px 10px 6px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 14px;
    row-gap: 8px;
    text-align: center;
    font-family: Source Han Sans SC, Noto Sans SC, sans-serif;
    font-size: 12px;
    color: #666;
}

.footer-contact,
.footer-icp {
    white-space: nowrap;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.footer-email {
    user-select: text;
}

.footer-copy-btn {
    margin-left: 0;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #444;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.footer-copy-btn:hover {
    background: #e9e9e9;
}

.page-controls button {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
    min-width: 32px;
}

.page-controls button:disabled {
    opacity: 0.4;
    cursor: default;
}

.page-jump {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    order: 1;
    flex: 0 0 100%;
    justify-content: center;
}

.page-jump input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
    background: #fff;
    color: #333;
}

.page-jump button {
    padding: 4px 10px;
}

/* 标题、作者、时间、品牌区域的占位符样式 */
.title-content:empty:before,
.author-content:empty:before,
.date-content:empty:before,
.brand-content:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
    opacity: 0.6;
    font-weight: normal; /* 确保占位符文字不加粗 */
}

.title-content:focus:empty:before,
.author-content:focus:empty:before,
.date-content:focus:empty:before,
.brand-content:focus:empty:before {
    opacity: 0.4;
}

/* 特别处理品牌区域的占位符，保持红色边框样式 */
.brand-content:empty:before {
    color: rgba(255, 59, 48, 0.6); /* 淡化的红色，与边框色调一致 */
}

/* 恢复原有的content-text样式，但现在用于其他区域 */
.old-content-text {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    width: 100%;
    height: 100%;
    max-height: calc(100% - 40px); /* 确保不超出容器 */
    gap: 1.2em;
    flex-wrap: nowrap;
    padding: 1em 0;
    align-content: flex-start;
    margin-left: auto;
    margin-right: 0;
    overflow: hidden; /* 防止内容超出 */
}

.content-column {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: end;
    font-size: 22px;
    line-height: 2;
    letter-spacing: 0.1em;
    height: 100%;
    max-height: calc(100vh - 200px); /* 动态高度限制 */
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    flex: 0 0 auto;
    min-width: 2.2em;
    max-width: 2.8em;
    padding: 0.2em 0.4em;
    border: 1px solid transparent;
    transition: border-color 0.2s;
    margin-top: 0;
    position: relative;
    overflow: hidden; /* 防止文字超出列边界 */
    word-break: break-all; /* 强制换行 */
    overflow-wrap: break-word; /* 长单词换行 */
}

/* 第1列（最右侧）显示默认文字 */
.content-column:first-child {
    justify-content: flex-end;
    align-items: flex-start;
    padding-right: 0;
    margin-top: 0;
    text-align: end;
    margin-right: 0;
}

/* 确保所有列顶部对齐 */
.content-column {
    align-self: flex-start;
}

.content-column:hover {
    border-color: rgba(102, 102, 102, 0.2);
}

.content-column:focus {
    border-color: rgba(102, 102, 102, 0.4);
    outline: none;
}

/* 确保所有列顶部对齐 */
.content-text > .content-column {
    align-self: flex-start;
}

/* 优化列间距和对齐 */
.content-text {
    align-content: flex-start;
}

/* 响应式列间距调整 */
@media (max-width: 768px) {
    .content-text {
        gap: 1em;
    }
    
    .content-column {
        padding: 0.2em 0.6em;
    }
}

/* 优化列的最小宽度 */
.content-column {
    min-width: 1.8em;
}

/* 右侧栏目内容 - 精细调整左右边距 */
.title-section,
.translation-section,
.author-section {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px; /* 统一左右边距为15px，确保字体距离左右边框距离一样 */
    text-align: center;
    background: transparent; /* 确保透明背景 */
    width: 100%; /* 确保占满容器宽度 */
    box-sizing: border-box; /* 包含padding在内的尺寸计算 */
}

.title-content {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    font-size: 26px;
    font-weight: bold;
    line-height: 2;
    letter-spacing: 0.1em;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; /* 确保占满父容器宽度 */
    margin: 0; /* 重置margin，依靠父容器的padding控制边距 */
    padding: 0; /* 确保内容元素本身没有额外padding */
    position: relative; /* 确保垂直居中定位 */
}

.translation-content {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0.05em;
    color: #666;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; /* 确保占满父容器宽度 */
    margin: 0; /* 重置margin，依靠父容器的padding控制边距 */
    padding: 0; /* 确保内容元素本身没有额外padding */
    position: relative; /* 确保垂直居中定位 */
}

.author-content {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.8;
    letter-spacing: 0.1em;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; /* 确保占满父容器宽度 */
    margin: 0; /* 重置margin，依靠父容器的padding控制边距 */
    padding: 0; /* 确保内容元素本身没有额外padding */
    position: relative; /* 确保垂直居中定位 */
}

/* 可编辑内容样式 */
[contenteditable="true"] {
    outline: none;
    cursor: text;
    transition: background-color 0.2s;
}

[contenteditable="true"]:hover {
    background-color: rgba(102, 102, 102, 0.05);
}

[contenteditable="true"]:focus {
    background-color: rgba(102, 102, 102, 0.1);
}



/* 背景图片样式 */
.editor-wrapper.with-background {
    position: relative;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.3s ease;
}

.texture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
}

/* 响应式设计 - 改进版 */

/* 平板设备 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .toolbar {
        padding: 12px;
        gap: 15px;
    }
    
    .font-controls {
        gap: 12px;
    }
    
    .editor-wrapper {
        width: min(80vw, 500px);
        height: min(80vw, 500px);
    }
    
    .editor-wrapper.layout-3-4 {
        width: min(60vw, 375px);
        height: min(80vw, 500px);
    }
    
    .editor-wrapper.layout-4-3 {
        width: min(80vw, 500px);
        height: min(60vw, 375px);
    }
    
    .editor-wrapper.layout-16-9 {
        width: min(80vw, 480px);
        height: min(45vw, 270px);
    }
    
    .editor-wrapper.layout-9-16 {
        width: min(45vw, 270px);
        height: min(80vw, 480px);
    }
}

/* 手机设备 (最大 767px) */
@media (max-width: 767px) {
    body {
        padding: 10px;
        gap: 12px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        gap: 12px;
    }
    
    .toolbar-section {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .toolbar-section label {
        font-size: 13px;
    }
    
    .font-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .font-control-item {
        min-width: 100%;
        justify-content: space-between;
    }
    
    .font-control-item input[type="range"] {
        width: 60px;
    }
    
    .editor-container {
        padding: 0 10px;
    }
    
    .editor-wrapper {
        width: min(95vw, 350px);
        height: min(95vw, 350px);
        margin: 10px;
    }
    
    .editor-wrapper.layout-3-4 {
        width: min(75vw, 280px);
        height: min(100vw, 375px);
    }
    
    .editor-wrapper.layout-4-3 {
        width: min(100vw, 375px);
        height: min(75vw, 280px);
    }
    
    .editor-wrapper.layout-16-9 {
        width: min(95vw, 320px);
        height: min(53vw, 180px);
    }
    
    .editor-wrapper.layout-9-16 {
        width: min(53vw, 180px);
        height: min(95vw, 320px);
    }
    
    /* 移动端栏目调整 */
    .left-column {
        min-width: 40px;
        max-width: 60px; /* 保持与桌面端的比例关系 */
    }
    
    .center-column {
        min-width: 150px;
    }
    
    .right-column {
        min-width: 80px; /* 调整移动端最小宽度，保持2:1比例关系 */
        max-width: 120px; /* 调整右侧栏目最大宽度，保持比例协调 */
    }
    
    /* 移动端字体大小调整 */
    .date-content,
    .brand-content,
    .title-content,
    .author-content,
    .main-text-input {
        font-size: clamp(12px, 4vw, 18px) !important;
    }
}

/* 超小屏幕设备 (最大 480px) */
@media (max-width: 480px) {
    .editor-wrapper {
        width: min(98vw, 300px);
        height: min(98vw, 300px);
    }
    
    .editor-wrapper.layout-3-4 {
        width: min(85vw, 250px);
        height: min(113vw, 335px);
    }
    
    .editor-wrapper.layout-4-3 {
        width: min(113vw, 335px);
        height: min(85vw, 250px);
    }
    
    .editor-wrapper.layout-16-9 {
        width: min(98vw, 280px);
        height: min(55vw, 157px);
    }
    
    .editor-wrapper.layout-9-16 {
        width: min(55vw, 157px);
        height: min(98vw, 280px);
    }
    
    .font-control-item input[type="range"] {
        width: 50px;
    }
    
    .font-control-item span {
        min-width: 30px;
        font-size: 11px;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.editor-wrapper {
    animation: fadeIn 0.5s ease-out;
}

/* 重要：确保所有可能遮盖背景的元素都是透明的 */
.main-text-input,
.content-text,
.content-column,
textarea,
input[type="text"],
[contenteditable="true"] {
    background: transparent !important;
}

/* 确保编辑器内部元素不会遮盖背景图片 */
.editor-wrapper .left-column,
.editor-wrapper .center-column,
.editor-wrapper .right-column,
.editor-wrapper .date-section,
.editor-wrapper .brand-section,
.editor-wrapper .content-section,
.editor-wrapper .title-section,
.editor-wrapper .author-section {
    background: transparent !important;
    position: relative;
    z-index: 1;
}

/* 只保留必要的白色背景 */
.toolbar {
    background: white !important;
}

/* 简化的背景图片样式 - 仅支持滑块缩放 */
.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none; /* 禁用交互 */
    cursor: default;
    transform-origin: center; /* 从中心点缩放 */
    overflow: visible; /* 允许背景超出边框 */
}

/* 背景图片操作提示已移至工具栏 */

/* 光标闪烁动画 - 用于新列指示 */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toastFadeIn 0.3s ease-out;
    pointer-events: none;
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}
