@font-face {
    font-family: 'simkai';
    src: url('fonts/simkai.woff2') format('woff2'),
         url('fonts/simkai.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'FZQiTi-S14S';
    src: url('fonts/FZQiTi-S14S.woff2') format('woff2'),
         url('fonts/FZQiTi-S14S.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'FZQiTi-S14T';
    src: url('fonts/FZQiTi-S14T.woff2') format('woff2'),
         url('fonts/FZQiTi-S14T.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'JiGuHanLi';
    src: url('fonts/汲古汉隶.woff2') format('woff2'),
         url('fonts/汲古汉隶.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'TianYingZhangKaiShu';
    src: url('fonts/田英章楷书.woff2') format('woff2'),
         url('fonts/田英章楷书.woff') format('woff'),
         url('fonts/田英章楷书.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'FZXiaoZhuan';
    src: url('fonts/方正小篆体.woff2') format('woff2'),
         url('fonts/方正小篆体.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

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

body {
    font-family: "楷体", "KaiTi", serif;
    background-color: #f5f5dc;
    color: #333;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.container {
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.main-layout {
    display: flex;
    gap: 20px;
    height: 100%;
}

.left-panel {
    width: 350px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    max-height: 100%;
}

.right-panel {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    border-bottom: 2px solid #8b4513;
}

header h1 {
    font-size: 2.5em;
    color: #8b4513;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    color: #666;
}

.controls {
    background-color: #fff;
    padding: 23.6px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.controls h3 {
    margin-bottom: 15px;
    color: #8b4513;
    font-size: 1.1em;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.control-group label {
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

.control-group select,
.control-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.paper-bg-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.paper-bg-row select {
    flex: 1;
}

.paper-bg-thumb {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    border: 1px solid #ddd;
    object-fit: cover;
    flex-shrink: 0;
}

/* 自定义宣纸背景下拉 */
.custom-select {
    position: relative;
    width: 100%;
    cursor: pointer;
    user-select: none;
}

.custom-select-value {
    padding: 8px 30px 8px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.custom-select-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #888;
    pointer-events: none;
}

.custom-select-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.custom-select.open .custom-select-options {
    display: block;
}

.custom-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.15s;
}

.custom-option:hover {
    background: #f0f0f0;
}

.custom-option.selected {
    background: #e8e4d8;
    font-weight: bold;
}

.custom-option img {
    width: 30px;
    height: 30px;
    border-radius: 3px;
    object-fit: cover;
    margin-left: 8px;
    flex-shrink: 0;
}

.input-area {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.input-area h3 {
    margin-bottom: 15px;
    color: #8b4513;
    font-size: 1.1em;
}

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

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

.input-group textarea {
    min-height: 150px;
    resize: vertical;
}

#renderBtn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #8b4513;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#renderBtn:hover {
    background-color: #6b3410;
}

.preview-area {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.preview-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-start;
    padding: 0px;
    overflow: auto;
    background-color: #f0f0f0;
    border-radius: 4px;
    min-height: 0;
    height: 100%;
}

.preview-area h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #8b4513;
}

.preview-wrapper {
    display: flex;
    align-items: flex-start;
    padding: 0px;
    overflow: auto;
    max-height: 90vh;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.preview-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.preview-wrapper::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 5px;
}

.preview-wrapper::-webkit-scrollbar-thumb {
    background: #8b4513;
    border-radius: 5px;
}

.preview-wrapper::-webkit-scrollbar-thumb:hover {
    background: #6b3410;
}

.preview-container {
    background-color: #fefefe;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: visible;
    position: relative;
    margin: 0 auto;
    background-image: 
        radial-gradient(ellipse at center, #fff 0%, #f5f0e6 100%);
    box-shadow: inset 0 0 30px rgba(139, 69, 19, 0.1);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.preview-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.preview-footer button {
    padding: 8px 16px;
    background-color: #8b4513;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    height: 36px;
    line-height: 20px;
}

.preview-footer button:hover {
    background-color: #6b3410;
}

.zoom-controls span {
    min-width: 60px;
    text-align: center;
    font-size: 14px;
    color: #555;
}

/* 格子样式 */
.grid-cell {
    position: relative;
    box-sizing: border-box;
}

.grid-container {
    box-sizing: border-box;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    body {
        height: auto;
        overflow: auto;
    }

    .main-layout {
        flex-direction: column;
        height: auto;
    }
    
    .left-panel {
        width: 100%;
        max-height: none;
        overflow-y: visible;
    }
    
    .right-panel {
        height: auto;
    }

    .preview-area {
        flex: none;
    }

    .preview-wrapper {
        max-height: 60vh;
        flex: none;
    }
}

/* 打印样式 */
@media print {
    body {
        background-color: #fff;
    }
    
    .controls,
    .input-area,
    .actions,
    .preview-footer,
    .left-panel {
        display: none;
    }
    
    .preview-area {
        box-shadow: none;
        padding: 0;
    }
    
    .preview-container {
        border: none;
    }
}
