* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa;
    color: #2c3e50;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

header h1 {
    color: #3498db;
    font-size: 2em;
    margin-bottom: 2px;
    font-weight: 600;
}

header h2 {
    color: #7f8c8d;
    font-size: 1em;
    font-weight: normal;
}

.synopsis-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.synopsis-section textarea {
    width: 100%;
    height: 100px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    transition: border-color 0.3s ease;
}

.synopsis-section textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.mode-tabs {
    display: flex;
    background: white;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    gap: 5px;
    width: fit-content;
    min-width: 120px;
    margin: 0 auto;
}

.mode-tab {
    flex: 1;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: #7f8c8d;
    height: 36px;
    box-sizing: border-box;
}

.mode-tab.active {
    background: #3498db;
    color: white;
}

.mode-tab:hover:not(.active) {
    background: #f5f6f7;
}

.content-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    min-height: 300px;
    max-height: 800px;
}

.content-area {
    display: flex;
    gap: 20px;
    flex: 1;
}

.left-panel, .right-panel {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

.left-panel-input {
    width: 100%;
    height: 100%;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    transition: all 0.3s ease;
    background: white;
}

.left-panel-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

#chunkContainer {
    flex: 2;
    overflow-y: auto;
    padding-right: 10px;
}

.column-headers {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.left-header, .right-header {
    width: 300px;
}

.chunk-container {
    display: flex;
    gap: 20px;
    margin-bottom: 0px;
    position: relative;
    padding: 5px 0 5px 10px;
    border-left: 3px solid transparent;
    transition: border-color 0.2s ease;
    user-select: none;
    pointer-events: none;
}

.chunk-container.selected {
    background: transparent;
    border-left-color: #3498db;
}

.x-item, .y-item, .revision-item {
    flex: 1;
    position: relative;
}

.x-item.hidden, .y-item.hidden {
    display: none;
}

.revision-item {
    display: none;
}

.revision-item.visible {
    display: block;
}

.x-input, .y-input, .revision-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    transition: all 0.3s ease;
    overflow: hidden;
    height: auto;
    background: white;
    pointer-events: auto;
}

.x-input:focus, .y-input:focus, .revision-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.y-input, .revision-input {
    background: #f8f9fa;
}

.revision-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.revision-actions.hidden {
    display: none;
}

.accept-btn, .reject-btn {
    padding: 4px 12px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.accept-btn {
    background: #2ecc71;
}

.accept-btn:hover {
    background: #27ae60;
    transform: translateY(-1px);
}

.reject-btn {
    background: #e74c3c;
}

.reject-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.chunk-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: none;
    gap: 4px;
    pointer-events: auto;
    z-index: 10;
}

.chunk-container:focus-within .chunk-actions {
    display: flex;
}

.add-x-btn, .delete-x-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.add-x-btn {
    background: #3498db;
}

.add-x-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.delete-x-btn {
    background: #e74c3c;
}

.delete-x-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.prompt-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.prompt-input {
    margin-top: 20px;
}

.prompt-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 18px;
}

.prompt-input textarea {
    width: 100%;
    height: 120px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.prompt-input textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
    background-color: white;
}

.prompt-actions {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.action-btn {
    min-width: 120px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    background: #3498db;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-group {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

.select-wrapper {
    flex: 1;
    min-width: 100px;
}

.select-wrapper select {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.column-header-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 左侧标题组 */
.left-header .column-header-wrapper span {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    padding-left: 15px;
    white-space: nowrap;
    min-width: 80px;
}

/* 右侧标题组 */
.right-header .column-header-wrapper span {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    padding-left: 15px;
    white-space: nowrap;
}

/* 复制按钮 */
.copy-btn {
    padding: 4px 8px;
    background: #f0f2f5;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #e4e6e9;
    color: #333;
    transform: translateY(-1px);
    border-color: #d0d0d0;
}

.batch-actions {
    display: flex;
    gap: 10px;
}

.batch-actions.hidden {
    display: none;
}

.batch-accept-btn,
.batch-reject-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.batch-accept-btn {
    background: #2ecc71;
}

.batch-accept-btn:hover {
    background: #27ae60;
    transform: translateY(-1px);
}

.batch-reject-btn {
    background: #e74c3c;
}

.batch-reject-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.model-select {
    min-width: 100px !important;
}

.mode-chapter-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    margin: 0;
    padding: 10px;
    position: relative;
}

.mode-selection {
    display: flex;
    justify-content: center;
    flex: 0 1 auto;
    min-width: 280px;
}

.chapter-selection {
    position: absolute;
    right: 20px;
    transition: opacity 0.3s ease;
}

.chapter-selection.hidden {
    opacity: 0;
    pointer-events: none;
}

.chapter-selection .select-wrapper select {
    min-width: 100px;
    padding: 8px 15px;
}

/* 响应式布局 */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
    }

    /* 标题适配 */
    header h1 {
        font-size: 1.5em;
    }
    
    header h2 {
        font-size: 0.9em;
    }

    /* 模式选择适配 */
    .mode-chapter-wrapper {
        flex-direction: column;
        align-items: center;
        padding: 5px;
    }

    .mode-tab {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* Prompt 区域适配 */
    .prompt-actions {
        display: grid;
        grid-template-columns: 120px 1fr; /* 两列布局：按钮列和下拉框列 */
        gap: 10px;
        align-items: start;
    }

    .action-btn {
        width: 120px;
    }

    .dropdown-group {
        display: flex;
        flex-direction: row;
        gap: 8px;
        min-width: 0;
        width: 100%;
    }

    .select-wrapper {
        flex: 1;
        min-width: 80px;
    }

    /* 内容区域适配 */
    .content-section {
        flex-direction: column;
    }

    .column-headers {
        flex-wrap: wrap;
        gap: 10px;
    }

    .left-header, .right-header {
        min-width: 160px;
        width: auto;
    }

    .chapter-selection {
        position: static;
        margin-top: 10px;
    }

    .column-header-wrapper {
        width: auto;
        flex-wrap: nowrap;
    }

    .column-header-wrapper span {
        flex-shrink: 0;
    }

    .copy-btn {
        flex-shrink: 0;
        margin-left: 15px;
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    .mode-tab:hover,
    .action-btn:hover,
    .copy-btn:hover {
        transform: none;
    }

    /* 增大点击区域 */
    .action-btn,
    .copy-btn,
    select,
    .mode-tab {
        min-height: 44px;
        padding: 12px;
    }
}

/* 超屏幕适配 */
@media screen and (max-width: 360px) {
    .mode-chapter-wrapper {
        justify-content: center;
        padding: 5px;
    }

    .mode-selection {
        position: relative;
        z-index: 1000;
        display: flex;
        justify-content: center;
        width: auto;
    }

    .mode-tabs {
        width: 120px;
        min-width: 120px;
    }

    .mode-tabs:not(.expanded) .mode-tab {
        display: none;
        padding: 8px 12px;
        justify-content: flex-start;
    }

    .mode-tabs:not(.expanded) .mode-tab.active {
        display: flex;
    }

    .mode-tabs.expanded {
        position: absolute;
        flex-direction: column;
        width: 120px;
        z-index: 100;
        background: white;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        padding: 4px;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
    }

    .mode-tabs.expanded .mode-tab {
        display: flex !important;
        width: 100%;
        justify-content: flex-start;
        padding: 8px 12px;
        margin: 2px 0;
        border-radius: 4px;
        height: 36px;
    }

    .mode-tab.active {
        position: relative;
        padding-right: 28px !important;
    }

    .mode-tab.active::after {
        content: "▼";
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 10px;
        transition: transform 0.3s;
        opacity: 0.8;
    }

    .mode-tabs.expanded .mode-tab.active::after {
        transform: translateY(-50%) rotate(180deg);
    }
}

/* 中等屏幕适配 */
@media screen and (min-width: 361px) and (max-width: 480px) {
    .mode-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* 超小屏幕适配 */
@media screen and (max-width: 480px) {
    .prompt-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .action-btn {
        width: 100%;
        height: 36px;
    }

    .dropdown-group {
        flex-direction: column;
        width: 100%;
    }

    .select-wrapper {
        width: 100%;
    }

    .select-wrapper select {
        width: 100%;
        height: 36px;
    }
}

/* 中等屏幕的两列布局保持不变 */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .prompt-actions {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 10px;
        align-items: start;
    }
    /* ... 其他样式保持不变 ... */
}

/* 响应式布局调整 */
@media screen and (max-width: 768px) {
    .column-headers {
        gap: 15px;
    }

    .left-header, .right-header {
        gap: 15px;
    }

    /* 确保标题和按钮的对齐 */
    .column-header-wrapper {
        width: auto;
        min-width: 0;
    }

    .column-header-wrapper span {
        flex-shrink: 0;
        min-width: 70px;
    }

    .copy-btn {
        flex-shrink: 0;
        padding: 4px 6px;
    }
}

/* 超小屏幕适配 */
@media screen and (max-width: 480px) {
    .column-headers {
        gap: 10px;
    }

    .left-header, .right-header {
        gap: 10px;
        width: 100%;
    }

    .column-header-wrapper {
        width: 100%;
        justify-content: space-between;
    }

    .column-header-wrapper span {
        padding-left: 0;
    }
}

/* 内容区域布局 */
.content-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    min-height: 300px;
    max-height: 800px;
}

/* 标题和内容区域的布局 */
.content-area {
    display: flex;
    gap: 20px;
    flex: 1;
}

/* 左右面板布局 */
.left-panel, .right-panel {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

/* 标题区域布局 */
.column-headers {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.left-header, .right-header {
    width: 300px;
}

.column-header-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 响应式布局调整 */
@media screen and (max-width: 768px) {
    .content-section {
        flex-direction: column;
    }

    .content-area {
        flex-direction: column;
    }

    .left-panel, .right-panel {
        width: 100%;
        min-width: 0;
        flex: none;
    }

    .column-headers {
        flex-direction: column;
        gap: 10px;
    }

    .left-header, .right-header {
        width: 100%;
    }
}

/* 标题和按钮样式 */
.column-header-wrapper span {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    padding-left: 15px;
    white-space: nowrap;
}

.copy-btn {
    padding: 4px 8px;
    background: #f0f2f5;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chapter-selection {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
}

.chapter-selection .select-wrapper {
    min-width: 120px;
}

.chapter-selection select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

.chapter-selection select:hover {
    border-color: #999;
}

/* 针对小屏幕的优化 */
@media screen and (max-width: 480px) {
    .container {
        padding: 5px;
    }

    .column-headers {
        flex-direction: column;
        gap: 5px;
    }

    .left-header, .right-header {
        width: 100%;
    }

    .copy-btn {
        padding: 4px 6px;
        font-size: 10px;
    }

    .chunk-container {
        flex-direction: column;
        padding: 5px;
        border-left: 3px solid #3498db;
        margin-bottom: 10px;
    }

    .x-input, .y-input, .revision-input {
        font-size: 14px;
        padding: 8px;
        border: 1px solid #ddd;
        margin-bottom: 5px;
    }

    .x-input::before, .y-input::before, .revision-input::before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        margin-bottom: 2px;
    }

    .revision-actions {
        flex-direction: column;
        gap: 5px;
    }

    .accept-btn, .reject-btn {
        width: 100%;
        padding: 6px;
    }
}

