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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-height: calc(100vh - 40px);
}

.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    padding: 24px 32px;
    color: #fff;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.header .subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.tab-btn {
    padding: 14px 24px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab-btn:hover {
    color: #4facfe;
    background: #f0f7ff;
}

.tab-btn.active {
    color: #4facfe;
    background: #fff;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #4facfe;
}

.tab-content {
    display: none;
    padding: 24px;
}

.tab-content.active {
    display: block;
}

/* 顶部区域：输入文本和排版结果左右并排 */
.top-section {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.top-section .panel {
    flex: 1;
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.text-area {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: none;
    resize: vertical;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    background: transparent;
    font-family: inherit;
}

.text-area:focus {
    outline: none;
}

.text-area::placeholder {
    color: #999;
}

/* 下方区域：功能按钮 */
.bottom-section {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.bottom-section .section {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
    min-width: 200px;
}

.bottom-section .section.wide-section {
    flex: 1;
    min-width: 100%;
}

.section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

.btn-secondary {
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-action {
    background: #fff;
    color: #555;
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    font-size: 12px;
}

.btn-action:hover {
    background: #f0f7ff;
    border-color: #4facfe;
    color: #4facfe;
}

.btn-danger {
    background: #ff6b6b;
    color: #fff;
    padding: 6px 10px;
}

.btn-danger:hover {
    background: #ee5a5a;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 15px;
}

/* 统计区域 */
.stats-section {
    margin-top: 24px;
}

.stats-wide {
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
    border-radius: 12px;
    padding: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
}

.stat-label {
    font-size: 13px;
    color: #666;
}

.stat-value {
    font-size: 13px;
    font-weight: 600;
    color: #e74c3c;
}

/* 对比面板 */
.compare-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.compare-panel .panel {
    flex: 1;
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
}

.compare-result {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
    min-height: 150px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-add {
    color: #27ae60;
    background: #e8f5e9;
}

.diff-remove {
    color: #e74c3c;
    background: #ffebee;
}

.diff-equal {
    color: #666;
}

/* 替换面板 */
.replace-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.replace-panel .panel {
    flex: 1;
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
}

.replace-rules {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
}

.rule-item {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.rule-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
}

.rule-input:focus {
    outline: none;
    border-color: #4facfe;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .top-section {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 16px 20px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .tab-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .tab-content {
        padding: 16px;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .bottom-section {
        flex-direction: column;
    }
    
    .bottom-section .section {
        min-width: 100%;
    }
    
    .btn-group-horizontal {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 标题模板简洁页面样式 */
.template-simple-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* 简单行布局 */
.simple-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.simple-row.single .simple-field {
    width: 100%;
    max-width: none;
}

.simple-field {
    flex: 1;
}

.simple-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.simple-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.simple-select:focus {
    outline: none;
    border-color: #4facfe;
    background: #f0f9ff;
}

/* 关键词标签 */
.simple-keywords {
    margin-bottom: 24px;
}

.simple-keywords label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
}

.keyword-chips.primary {
    margin-bottom: 16px;
}

.keyword-chips.primary .primary-chip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
}

.keyword-chips.primary .primary-chip:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-2px);
}

.keyword-chips.primary .primary-chip.active {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-color: #4facfe;
}

.keyword-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 网盘选择 */
.simple-cloud {
    margin-bottom: 24px;
}

.simple-cloud label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
}

.cloud-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cloud-chip {
    padding: 8px 16px;
    border: 1px solid #ffd591;
    border-radius: 20px;
    background: #fffbf5;
    font-size: 14px;
    color: #e65100;
    cursor: pointer;
    transition: all 0.2s;
}

.cloud-chip:hover {
    background: #fff3e0;
    border-color: #ffb74d;
}

.cloud-chip.active {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-color: #f57c00;
    color: #fff;
}

.chip {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    border-color: #4facfe;
    color: #4facfe;
    background: #f0f9ff;
}

.chip.active {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    border-color: #4facfe;
    color: #fff;
}

/* 输入区域 */
.simple-input-area {
    margin-bottom: 24px;
}

.simple-input-area label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.simple-input {
    width: 100%;
    padding: 18px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #fafafa;
    transition: all 0.2s;
}

.simple-input:focus {
    outline: none;
    border-color: #4facfe;
    background: #fff;
}

/* 预览区域 */
.simple-preview {
    margin-bottom: 28px;
}

.simple-preview label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.preview-box {
    padding: 24px;
    background: linear-gradient(135deg, #f0f7ff, #e6f0fa);
    border: 2px solid #d0e7ff;
    border-radius: 12px;
    font-size: 16px;
    color: #333;
    min-height: 60px;
    word-break: break-all;
}

/* 操作按钮 */
.simple-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-icon {
    margin-right: 6px;
}

/* 频道按钮网格 */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.channel-group-title {
    grid-column: 1 / -1;
    font-size: 13px;
    font-weight: 600;
    color: #4facfe;
    margin-top: 12px;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.channel-btn {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.channel-btn:hover {
    border-color: #4facfe;
    color: #4facfe;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.2);
}

/* 弹窗样式 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #e0e0e0;
    color: #666;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-keywords label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
    margin-top: 16px;
}

.modal-keywords label:first-child {
    margin-top: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #eee;
}

.modal-footer .btn {
    min-width: 100px;
}

/* 频道页面标题 */
.channel-page-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

/* 完整的频道网格 */
.channel-grid-full {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.channel-group {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 4px 0;
}

.channel-grid-full .channel-group-title {
    width: 100%;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #3b82f6;
    margin-top: 8px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

.channel-grid-full .channel-btn {
    width: 100%;
    padding: 10px 8px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-grid-full .channel-btn:first-of-type {
    margin-top: 0;
}

/* 大弹窗 */
.modal-content-large {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}